Class JRHibernateAbstractDataSource
- java.lang.Object
-
- net.sf.jasperreports.j2ee.hibernate.JRHibernateAbstractDataSource
-
- All Implemented Interfaces:
JRDataSource
- Direct Known Subclasses:
JRHibernateIterateDataSource
,JRHibernateListDataSource
,JRHibernateScrollDataSource
public abstract class JRHibernateAbstractDataSource extends Object implements JRDataSource
Base abstract Hibernate data source.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
JRHibernateAbstractDataSource.FieldReader
Interface used to get the value of a report field from a result row.protected static class
JRHibernateAbstractDataSource.IdentityFieldReader
protected static class
JRHibernateAbstractDataSource.IndexFieldReader
protected static class
JRHibernateAbstractDataSource.IndexPropertyFieldReader
protected static class
JRHibernateAbstractDataSource.PropertyFieldReader
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_FIELD_ALIAS_TYPE_MISMATCH
static String
EXCEPTION_MESSAGE_KEY_MANY_FIELDS_DETECTED
static String
EXCEPTION_MESSAGE_KEY_NO_FIELD_ALIAS
static String
EXCEPTION_MESSAGE_KEY_NO_FIELD_READER
static String
EXCEPTION_MESSAGE_KEY_UNKNOWN_RETURN_ALIAS
protected JRHibernateQueryExecuter
queryExecuter
-
Constructor Summary
Constructors Modifier Constructor Description protected
JRHibernateAbstractDataSource(JRHibernateQueryExecuter queryExecuter, boolean useFieldDescription, boolean useIndexOnSingleReturn)
Creates a Hibernate data source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,JRHibernateAbstractDataSource.FieldReader>
assignReaders(boolean useIndexOnSingleReturn)
Assigns field readers to report fields.protected String
getFieldMapping(JRField field)
protected JRHibernateAbstractDataSource.FieldReader
getFieldReader(org.hibernate.type.Type[] returnTypes, Map<String,Integer> aliasesMap, JRField field)
protected JRHibernateAbstractDataSource.FieldReader
getFieldReaderSingleReturn(Map<String,Integer> aliasesMap, JRField field, boolean useIndex)
Object
getFieldValue(JRField jrField)
Gets the field value for the current position.protected void
setCurrentRowValue(Object currentReturnValue)
Sets the current row of the query result.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jasperreports.engine.JRDataSource
next
-
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_FIELD_ALIAS_TYPE_MISMATCH
public static final String EXCEPTION_MESSAGE_KEY_FIELD_ALIAS_TYPE_MISMATCH
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_MANY_FIELDS_DETECTED
public static final String EXCEPTION_MESSAGE_KEY_MANY_FIELDS_DETECTED
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_NO_FIELD_ALIAS
public static final String EXCEPTION_MESSAGE_KEY_NO_FIELD_ALIAS
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_NO_FIELD_READER
public static final String EXCEPTION_MESSAGE_KEY_NO_FIELD_READER
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_UNKNOWN_RETURN_ALIAS
public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_RETURN_ALIAS
- See Also:
- Constant Field Values
-
queryExecuter
protected final JRHibernateQueryExecuter queryExecuter
-
-
Constructor Detail
-
JRHibernateAbstractDataSource
protected JRHibernateAbstractDataSource(JRHibernateQueryExecuter queryExecuter, boolean useFieldDescription, boolean useIndexOnSingleReturn)
Creates a Hibernate data source.- Parameters:
queryExecuter
- the query executeruseFieldDescription
- whether to use field descriptions for fields to results mappinguseIndexOnSingleReturn
- whether to use indexed addressing even when the query has only one return column
-
-
Method Detail
-
assignReaders
protected Map<String,JRHibernateAbstractDataSource.FieldReader> assignReaders(boolean useIndexOnSingleReturn)
Assigns field readers to report fields.- Parameters:
useIndexOnSingleReturn
- whether to use indexed addressing even when the query has only one return column- Returns:
- a report field name to field reader mapping
- See Also:
JRHibernateAbstractDataSource.FieldReader
-
getFieldReaderSingleReturn
protected JRHibernateAbstractDataSource.FieldReader getFieldReaderSingleReturn(Map<String,Integer> aliasesMap, JRField field, boolean useIndex)
-
getFieldReader
protected JRHibernateAbstractDataSource.FieldReader getFieldReader(org.hibernate.type.Type[] returnTypes, Map<String,Integer> aliasesMap, JRField field)
-
setCurrentRowValue
protected void setCurrentRowValue(Object currentReturnValue)
Sets the current row of the query result.- Parameters:
currentReturnValue
- the current row value
-
getFieldValue
public Object getFieldValue(JRField jrField) throws JRException
Description copied from interface:JRDataSource
Gets the field value for the current position.- Specified by:
getFieldValue
in interfaceJRDataSource
- Returns:
- an object containing the field value. The object type must be the field object type.
- Throws:
JRException
-
-