title: Hibernate: Generating Reports (Stored pocedures)
body: <p>I am working on an application using Hibernate (JPA 2.0), Spring 3.0.5 and Oracle 11g.</p>
  
  <p>I need to generate few reports (CSV's) based on a number of tables in the datasbase;</p>
  
  <p>The sample report CSV looks like this:</p>
  
  <pre><code>From_Date    TO_Date     Group   Metric     Mon     Tue      Wed     Thu    Fri
  
  10/01/2012   10/02/2012   HP     Average    29       74       400     99     14 
  10/02/2012   10/03/2012   HP     Average    81       19       22      108    07
  10/03/2012   10/04/2012   HP     Average    11       62       09      16     01
  
  10/01/2012   10/02/2012   HP     Total      924      452      915     100    940 
  10/02/2012   10/03/2012   HP     Total      185      925      266     108    857
  10/03/2012   10/04/2012   HP     Total      173      201      907     675    169
  </code></pre>
  
  <p>My question is as this report will depend on many tables and different metrics (average, total, and percentages), what is the best way forward with the given technology stack?</p>
  
  <p>I am currently not using any reporting api currently.</p>
  
  <p>Is stored procedure the way to go???</p>
  
  <p>Thanks !!</p>