title: Best approach with Jasper Report
body: <p>I have a requirement to generate reports in PDF and Excel format. For the same I have chosen Jasper. Now require some help from your side to identify the best approach on the same. </p>
  
  <p>Note - My queries are dynamic in nature.Like in some scenario then will provide name in some scenario they will provide dates not name and in some scenario both.</p>
  
  <p>Approaches I have identified are given below.</p>
  
  <ol>
  <li>We can create data source and query in JRXML and execute the same.But not sure query will be dynamic or not. I am personally not prefer this approach because from java I can pass the connection from pool.</li>
  <li>We can pass the query and connection both from the Java side and then Japser will execute the query.</li>
  <li>We can query in java and then pass the List of bean to the Jasper for report creation. </li>
  </ol>
  
  <p>Now need some suggestions on the best approach among above and also of any approach suggested apart from the above.</p>