Package net.sf.jasperreports.hibernate
Class JRHibernateAbstractDataSource
- java.lang.Object
-
- net.sf.jasperreports.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.IndexFieldReader
protected static class
JRHibernateAbstractDataSource.IndexPropertyFieldReader
-
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)
Creates a Hibernate data source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,JRHibernateAbstractDataSource.FieldReader>
assignReaders(jakarta.persistence.Tuple result)
Assigns field readers to report fields.protected JRHibernateAbstractDataSource.FieldReader
fieldReader(JRField jrField)
protected String
getFieldMapping(JRField field)
protected JRHibernateAbstractDataSource.FieldReader
getFieldReader(List<jakarta.persistence.TupleElement<?>> elements, Map<String,Integer> aliasesMap, JRField field)
protected JRHibernateAbstractDataSource.FieldReader
getFieldReaderSingleReturn(Map<String,Integer> aliasesMap, JRField field)
Object
getFieldValue(JRField jrField)
Gets the field value for the current position.protected boolean
isManagedType(jakarta.persistence.TupleElement<?> element)
protected void
setCurrentRowValue(jakarta.persistence.Tuple 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)
Creates a Hibernate data source.- Parameters:
queryExecuter
- the query executeruseFieldDescription
- whether to use field descriptions for fields to results mapping
-
-
Method Detail
-
assignReaders
protected Map<String,JRHibernateAbstractDataSource.FieldReader> assignReaders(jakarta.persistence.Tuple result)
Assigns field readers to report fields.- Returns:
- a report field name to field reader mapping
- See Also:
JRHibernateAbstractDataSource.FieldReader
-
isManagedType
protected boolean isManagedType(jakarta.persistence.TupleElement<?> element)
-
getFieldReaderSingleReturn
protected JRHibernateAbstractDataSource.FieldReader getFieldReaderSingleReturn(Map<String,Integer> aliasesMap, JRField field)
-
getFieldReader
protected JRHibernateAbstractDataSource.FieldReader getFieldReader(List<jakarta.persistence.TupleElement<?>> elements, Map<String,Integer> aliasesMap, JRField field)
-
setCurrentRowValue
protected void setCurrentRowValue(jakarta.persistence.Tuple currentReturnValue)
Sets the current row of the query result.- Parameters:
currentReturnValue
- the current row value
-
fieldReader
protected JRHibernateAbstractDataSource.FieldReader fieldReader(JRField jrField)
-
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
-
-