net.sf.jasperreports.engine.data
Class JRJpaDataSource

java.lang.Object
  extended by net.sf.jasperreports.engine.data.JRAbstractBeanDataSource
      extended by net.sf.jasperreports.engine.data.JRJpaDataSource
All Implemented Interfaces:
JRDataSource, JRRewindableDataSource

public class JRJpaDataSource
extends JRAbstractBeanDataSource

Java Persistence API data source that uses javax.persistence.Query.getResultList().

The query result can be paginated by not retrieving all the rows at once.

Fields are mapped to values in the result following these rules:

Version:
$Id: JRJpaDataSource.java 5180 2012-03-29 13:23:12Z teodord $
Author:
Marcel Overdijk (marceloverdijk@hotmail.com)
See Also:
JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_PAGE_SIZE

Nested Class Summary
protected static interface JRJpaDataSource.FieldValueReader
           
protected  class JRJpaDataSource.IndexPropertyReader
           
protected  class JRJpaDataSource.IndexReader
           
protected  class JRJpaDataSource.PropertyReader
           
 
Field Summary
protected  java.lang.Object currentRow
           
 
Fields inherited from class net.sf.jasperreports.engine.data.JRAbstractBeanDataSource
CURRENT_BEAN_MAPPING, FIELD_DESCRIPTION_PROPERTY_NAME_PROVIDER, FIELD_NAME_PROPERTY_NAME_PROVIDER, propertyNameProvider
 
Constructor Summary
JRJpaDataSource(JRJpaQueryExecuter queryExecuter, int pageSize)
           
 
Method Summary
protected  void fetchPage()
           
 java.lang.Object getFieldValue(JRField field)
          Gets the field value for the current position.
protected  JRJpaDataSource.FieldValueReader getFieldValueReader(JRField field)
           
 void moveFirst()
          Moves back to the first element in the data source.
 boolean next()
          Tries to position the cursor on the next element in the data source.
 
Methods inherited from class net.sf.jasperreports.engine.data.JRAbstractBeanDataSource
getBeanProperty, getFieldValue, getPropertyName, isCurrentBeanMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentRow

protected java.lang.Object currentRow
Constructor Detail

JRJpaDataSource

public JRJpaDataSource(JRJpaQueryExecuter queryExecuter,
                       int pageSize)
Method Detail

fetchPage

protected void fetchPage()

next

public boolean next()
Description copied from interface: JRDataSource
Tries to position the cursor on the next element in the data source.

Returns:
true if there is a next record, false otherwise

moveFirst

public void moveFirst()
Description copied from interface: JRRewindableDataSource
Moves back to the first element in the data source.


getFieldValue

public java.lang.Object getFieldValue(JRField field)
                               throws JRException
Description copied from interface: JRDataSource
Gets the field value for the current position.

Returns:
an object containing the field value. The object type must be the field object type.
Throws:
JRException

getFieldValueReader

protected JRJpaDataSource.FieldValueReader getFieldValueReader(JRField field)


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com