public class JRJpaDataSource extends JRAbstractBeanDataSource
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:
SELECT m FROM Movie m
or
SELECT NEW MovieDescription(m.title, m.genre) FROM Movie m
), then the fields are
mapped to bean property names.SELECT m.title, m.gender FROM Movie m
),
the fields are mapped using the following syntax: COLUMN_index[.property], with the
indexes starting from 1. Example mappings: COLUMN_1, COLUMN_2, COLUMN_2.title, COLUMN_2.movie.title.JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_PAGE_SIZE
Modifier and Type | Class and Description |
---|---|
protected static interface |
JRJpaDataSource.FieldValueReader |
protected class |
JRJpaDataSource.IndexPropertyReader |
protected class |
JRJpaDataSource.IndexReader |
protected class |
JRJpaDataSource.PropertyReader |
Modifier and Type | Field and Description |
---|---|
protected Object |
currentRow |
static String |
EXCEPTION_MESSAGE_KEY_INDEX_OUT_OF_BOUNDS |
CURRENT_BEAN_MAPPING, EXCEPTION_MESSAGE_KEY_BEAN_FIELD_VALUE_NOT_RETRIEVED, FIELD_DESCRIPTION_PROPERTY_NAME_PROVIDER, FIELD_NAME_PROPERTY_NAME_PROVIDER, propertyNameProvider
Constructor and Description |
---|
JRJpaDataSource(JRJpaQueryExecuter queryExecuter,
int pageSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
fetchPage() |
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.
|
getBeanProperty, getFieldValue, getPropertyName, isCurrentBeanMapping
public static final String EXCEPTION_MESSAGE_KEY_INDEX_OUT_OF_BOUNDS
protected Object currentRow
public JRJpaDataSource(JRJpaQueryExecuter queryExecuter, int pageSize)
protected void fetchPage()
public boolean next()
JRDataSource
public void moveFirst()
JRRewindableDataSource
public Object getFieldValue(JRField field) throws JRException
JRDataSource
JRException
protected JRJpaDataSource.FieldValueReader getFieldValueReader(JRField field)
Copyright © 2016. All rights reserved.