Its hard to give advice when I have no real idea of your data structure, I am unsure why you would have seperate tables for differents users unless you mean graphically.
If you have 5 separate tables 1 for each user then UNION seems to be the only way to do it, unless you know Java, you could put the data into beans and use a bean datasource to build your report.
I always find that subreports can normally be replaced with groups, I personally hate subreports...lol.
Sorry I forgot to mention that the info I gave is based on using iReport/jasperReports, not sure what you are using now but I definately recommend iReport.
If I understand your requirements correctly I think grouping would be better than having multiple subreports.
Grouping the data on users allows you to create a seperate table for each user, you can also have a header and footer for each user and you can also perform calculations and have totals at the bottom of each group.
Hope this helps.
Peter Jin wrote:
I may need to put several sub reports in the detail section in the master report. So the sub reports will get loaded many times. Will this cause significant performance issues? Does jasper cache data source for report in this case?
User's data are scattered in 5 tables and I need to put those data together under a particular user. I don't want to use UNION because HQL doesn't support it. In addition, Union 5 tables may result in a huge SQL. I have to use one sub report for each table and iterate users in master report and for each user iterate all sub reports to display data relevant to that user.