Java Doc for JRJpaQueryExecuter.java in  » Report » jasperreports-2.0.1 » net » sf » jasperreports » engine » query » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » jasperreports 2.0.1 » net.sf.jasperreports.engine.query 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sf.jasperreports.engine.query.JRAbstractQueryExecuter
      net.sf.jasperreports.engine.query.JRJpaQueryExecuter

JRJpaQueryExecuter
public class JRJpaQueryExecuter extends JRAbstractQueryExecuter (Code)
EJBQL query executer that uses the Java Persistence API.

To use EJBQL in queries, an javax.persistence.EntityManager is needed. When running or filling reports the em need to be supplied with the named parameter net.sf.jasperreports.engine.query.JRJpaQueryExecuterFactory.PARAMETER_JPA_ENTITY_MANAGER .

Example:

 Map parameters = new HashMap();
 EntityManager em = emf.createEntityManager();
 parameters.put(JRJpaQueryExecuterFactory.PARAMETER_JPA_ENTITY_MANAGER, em);
 JasperRunManager.runReportToPdfFile(fileName, parameters);
 

When dealing with large result sets, pagination can be used by setting the net.sf.jasperreports.engine.query.JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_PAGE_SIZE property in the report template.

Example:

 <property name="net.sf.jasperreports.ejbql.query.page.size" value="100"/>
 

Implementation-specific query hints can be set either using report properties in the report template, or by supplying the named parameter net.sf.jasperreports.engine.query.JRJpaQueryExecuterFactory.PARAMETER_JPA_QUERY_HINTS_MAP containing a java.util.Map with named/value query hints.

Example using report property:

 <property name="net.sf.jasperreports.ejbql.query.hint.fetchSize" value="100"/>
 
The name of the query hint need to be prefixed with net.sf.jasperreports.ejbql.query.hint. ( net.sf.jasperreports.engine.query.JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_HINT_PREFIX ). Above example will set a query hint with the name fetchSize and the String value 100.

Example using map:

 Map hints = new HashMap();
 hints.put("fetchSize", new Integer(100));
 hints.put("anyName", anyObject());
 Map parameters = new HashMap();
 EntityManager em = emf.createEntityManager();
 parameters.put(JRJpaQueryExecuterFactory.PARAMETER_JPA_ENTITY_MANAGER, em);
 parameters.put(JRJpaQueryExecuterFactory.PARAMETER_JPA_QUERY_HINTS_MAP, hints);
 JasperRunManager.runReportToPdfFile(fileName, parameters);
 
Note that when using report properties only String values can be set as query hint. When using a query hints map, any Object can be set as value.
author:
   Marcel Overdijk (marceloverdijk@hotmail.com)
version:
   $Id: JRJpaQueryExecuter.java 1472 2006-11-09 17:16:52Z lucianc $
See Also:   net.sf.jasperreports.engine.query.JRJpaQueryExecuterFactory



Constructor Summary
public  JRJpaQueryExecuter(JRDataset dataset, Map parameters)
    

Method Summary
public synchronized  booleancancelQuery()
    
public synchronized  voidclose()
    
public  JRDataSourcecreateDatasource()
    
protected synchronized  voidcreateQuery(String queryString)
     Creates the EJBQL query object.
protected  JRDataSourcecreateResultDatasource()
     Creates a data source out of the query result.
protected  StringgetEjbqlParameterName(String parameterName)
    
protected  StringgetParameterReplacement(String parameterName)
    
public  ListgetResultList()
     Runs the query by calling javax.persistence.Query.getResultList.
public  ListgetResultList(int firstIndex, int resultCount)
     Returns a page of the query results by calling javax.persistence.Query.getResultList.


Constructor Detail
JRJpaQueryExecuter
public JRJpaQueryExecuter(JRDataset dataset, Map parameters)(Code)




Method Detail
cancelQuery
public synchronized boolean cancelQuery() throws JRException(Code)



close
public synchronized void close()(Code)



createDatasource
public JRDataSource createDatasource() throws JRException(Code)



createQuery
protected synchronized void createQuery(String queryString)(Code)
Creates the EJBQL query object.
Parameters:
  queryString - the query string



createResultDatasource
protected JRDataSource createResultDatasource()(Code)
Creates a data source out of the query result. the data source



getEjbqlParameterName
protected String getEjbqlParameterName(String parameterName)(Code)



getParameterReplacement
protected String getParameterReplacement(String parameterName)(Code)



getResultList
public List getResultList()(Code)
Runs the query by calling javax.persistence.Query.getResultList.

All the result rows are returned. the result of the query as a list




getResultList
public List getResultList(int firstIndex, int resultCount)(Code)
Returns a page of the query results by calling javax.persistence.Query.getResultList.
Parameters:
  firstIndex - the index of the first row to return
Parameters:
  resultCount - the number of rows to return result row list



Fields inherited from net.sf.jasperreports.engine.query.JRAbstractQueryExecuter
final protected static int CLAUSE_POSITION_ID(Code)(Java Doc)
final protected Map clauseFunctions(Code)(Java Doc)
final protected JRDataset dataset(Code)(Java Doc)

Methods inherited from net.sf.jasperreports.engine.query.JRAbstractQueryExecuter
protected void addQueryMultiParameters(String parameterName, int count)(Code)(Java Doc)
protected void addQueryParameter(String parameterName)(Code)(Java Doc)
protected void appendClauseChunk(StringBuffer sbuffer, String[] clauseTokens)(Code)(Java Doc)
protected void appendParameterChunk(StringBuffer sbuffer, String chunkText)(Code)(Java Doc)
protected void appendParameterClauseChunk(StringBuffer sbuffer, String chunkText)(Code)(Java Doc)
protected void appendQueryChunk(StringBuffer sbuffer, JRQueryChunk chunk)(Code)(Java Doc)
protected void appendTextChunk(StringBuffer sbuffer, String text)(Code)(Java Doc)
protected void applyClause(JRClauseFunction function, JRClauseTokens tokens, StringBuffer sbuffer)(Code)(Java Doc)
protected void checkParameter(String parameterName)(Code)(Java Doc)
protected List getCollectedParameterNames()(Code)(Java Doc)
protected List getCollectedParameters()(Code)(Java Doc)
protected JRFillParameter getParameter(String parameterName)(Code)(Java Doc)
abstract protected String getParameterReplacement(String parameterName)(Code)(Java Doc)
protected Object getParameterValue(String parameterName, boolean ignoreMissing)(Code)(Java Doc)
protected Object getParameterValue(String parameterName)(Code)(Java Doc)
protected String getQueryString()(Code)(Java Doc)
protected JRValueParameter getValueParameter(String parameterName, boolean ignoreMissing)(Code)(Java Doc)
protected JRValueParameter getValueParameter(String parameterName)(Code)(Java Doc)
protected void parseQuery()(Code)(Java Doc)
protected void registerClauseFunction(String id, JRClauseFunction function)(Code)(Java Doc)
protected JRClauseFunction resolveFunction(String id)(Code)(Java Doc)
protected void unregisterClauseFunction(String id)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.