public class JRHibernateQueryExecuter extends JRAbstractQueryExecuter
JRAbstractQueryExecuter.QueryParameter, JRAbstractQueryExecuter.QueryParameterEntry, JRAbstractQueryExecuter.QueryParameterVisitor, JRAbstractQueryExecuter.ValuedQueryParameter, JRAbstractQueryExecuter.VisitExceptionWrapper
Modifier and Type | Field and Description |
---|---|
protected static String |
CANONICAL_LANGUAGE |
static String |
EXCEPTION_MESSAGE_KEY_UNKNOWN_QUERY_RUN_TYPE |
static String |
EXCEPTION_MESSAGE_KEY_UNRESOLVED_TYPE_CONSTANT |
CLAUSE_POSITION_ID, clauseFunctions, dataset, EXCEPTION_MESSAGE_KEY_NUMERIC_TYPE_REQUIRED, EXCEPTION_MESSAGE_KEY_PARAMETER_NOT_FOUND, EXCEPTION_MESSAGE_KEY_QUERY_CLAUSE_CIRCULARLY_NESTED_PARAMETER, EXCEPTION_MESSAGE_KEY_QUERY_CLAUSE_ID_FIRST_TOKEN_MISSING, EXCEPTION_MESSAGE_KEY_QUERY_CLAUSE_NOT_FOUND, EXCEPTION_MESSAGE_KEY_UNSUPPORTED_PARAMETER_TYPE, GET_COLLECTED
Constructor and Description |
---|
JRHibernateQueryExecuter(JasperReportsContext jasperReportsContext,
JRDataset dataset,
Map<String,? extends JRValueParameter> parameters) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancelQuery()
Cancels the query if it's currently running.
|
void |
clearCache() |
void |
close()
Closes the scrollable result when scroll execution type is used.
|
void |
closeScrollableResults()
Closes the scrollable results of the query.
|
JRDataSource |
createDatasource()
Creates an instance of
JRHibernateListDataSource ,
JRHibernateIterateDataSource or
JRHibernateScrollDataSource , depending on the |
protected void |
createQuery(String queryString)
Creates the Hibernate query object.
|
protected JRDataSource |
createResultDatasource()
Creates a data source out of the query result.
|
protected String |
getCanonicalQueryLanguage()
Returns a canonical query language for this query executer implementation.
|
JRDataset |
getDataset()
Returns the dataset for which the query executer has been created.
|
protected String |
getHqlParameterName(String parameterName) |
protected String |
getParameterReplacement(String parameterName)
Returns the replacement text for a query parameter.
|
String[] |
getReturnAliases()
Returns the aliases of the HQL query.
|
org.hibernate.type.Type[] |
getReturnTypes()
Returns the return types of the HQL query.
|
Iterator<?> |
iterate()
Runs the query by calling
org.hibernate.Query.iterate() . |
List<?> |
list()
Runs the query by calling
org.hibernate.Query.list() . |
List<?> |
list(int firstIndex,
int resultCount)
Returns a page of the query results by calling
org.hibernate.Query.iterate() . |
org.hibernate.ScrollableResults |
scroll()
Runs the query by calling
org.hibernate.Query.scroll() . |
protected void |
setParameter(JRValueParameter parameter)
Binds a parameter value to a query parameter.
|
protected void |
setParameters()
Binds values for all the query parameters.
|
protected void |
setQueryRunning(boolean queryRunning) |
addQueryMultiParameters, addQueryMultiParameters, addQueryParameter, addQueryParameter, appendClauseChunk, appendParameterChunk, appendParameterClauseChunk, appendQueryChunk, appendTextChunk, applyClause, checkParameter, findExtensionQueryFunction, getBooleanParameter, getBooleanParameter, getBooleanParameterOrProperty, getBooleanParameterOrProperty, getCollectedParameterNames, getCollectedParameters, getJasperReportsContext, getParameter, getParameterValue, getParameterValue, getPropertiesUtil, getQueryString, getStringParameter, getStringParameterOrProperty, getValueParameter, getValueParameter, parameterHasValue, parseQuery, registerClauseFunction, resolveFunction, unregisterClauseFunction, visitQueryParameters
public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_QUERY_RUN_TYPE
public static final String EXCEPTION_MESSAGE_KEY_UNRESOLVED_TYPE_CONSTANT
protected static final String CANONICAL_LANGUAGE
public JRHibernateQueryExecuter(JasperReportsContext jasperReportsContext, JRDataset dataset, Map<String,? extends JRValueParameter> parameters)
protected String getCanonicalQueryLanguage()
JRAbstractQueryExecuter
The canonical language is used to retrieve extensions for the query executer.
The default implementation returns the runtime query language used in the dataset, but query executer implementations should override this method and return a fixed language.
getCanonicalQueryLanguage
in class JRAbstractQueryExecuter
public JRDataSource createDatasource() throws JRException
JRHibernateListDataSource
,
JRHibernateIterateDataSource
or
JRHibernateScrollDataSource
, depending on theJRDataSource
wrapping the query execution result.JRException
protected JRDataSource createResultDatasource()
protected void createQuery(String queryString)
PARAMETER_HIBERNATE_FILTER_COLLECTION
is not null, then a filter query is created using the value of the parameter as the collection.queryString
- the query stringprotected void setParameters()
protected void setParameter(JRValueParameter parameter)
parameter
- the report parameterpublic void close()
public void closeScrollableResults()
public boolean cancelQuery() throws JRException
JRQueryExecuter
true
if and only if the query was running and it has been canceledJRException
protected String getParameterReplacement(String parameterName)
JRAbstractQueryExecuter
getParameterReplacement
in class JRAbstractQueryExecuter
parameterName
- the parameter nameJRQueryChunk.TYPE_PARAMETER
public org.hibernate.type.Type[] getReturnTypes()
public String[] getReturnAliases()
public JRDataset getDataset()
public List<?> list()
org.hibernate.Query.list()
.
All the result rows are returned.protected void setQueryRunning(boolean queryRunning)
public List<?> list(int firstIndex, int resultCount)
org.hibernate.Query.iterate()
.firstIndex
- the index of the first row to returnresultCount
- the number of rows to returnpublic Iterator<?> iterate()
org.hibernate.Query.iterate()
.public org.hibernate.ScrollableResults scroll()
org.hibernate.Query.scroll()
.public void clearCache()
Copyright © 2017. All rights reserved.