Problem Definition:
I have a Database table with huge amount of data(more than 100,000 rows) , table structure is like
AppID DocID DocStatus
1 100 0
1 101 1
2 200 0
2 300 1
Per applicationID there may be thousands of Documents, I have to fetch Count of the documents with status 0 and count of the documents with status 1 grouped by applicationID.
When I am mapping this object using hibernate, it will eat up lot of heap memory due to large amount of table data.
How Can I achieve this using Hibernate query? OR Should I use SQL Query or Stored Procedure for this ?
Note : My Web Application is in JAVA/Tapestry framework and using Hibernate 3. Database is SQL Server 2012.