Class JRHibernateQueryExecuter

java.lang.Object
net.sf.jasperreports.engine.query.JRAbstractQueryExecuter
net.sf.jasperreports.hibernate.JRHibernateQueryExecuter
All Implemented Interfaces:
JRQueryExecuter

public class JRHibernateQueryExecuter extends JRAbstractQueryExecuter
HQL query executer that uses Hibernate 3.
Author:
Lucian Chirita (lucianc@users.sourceforge.net)
  • Field Details

    • EXCEPTION_MESSAGE_KEY_UNKNOWN_QUERY_RUN_TYPE

      public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_QUERY_RUN_TYPE
      See Also:
    • EXCEPTION_MESSAGE_KEY_UNRESOLVED_TYPE_CONSTANT

      public static final String EXCEPTION_MESSAGE_KEY_UNRESOLVED_TYPE_CONSTANT
      See Also:
    • CANONICAL_LANGUAGE

      public static final String CANONICAL_LANGUAGE
      See Also:
  • Constructor Details

  • Method Details

    • getCanonicalQueryLanguage

      protected String getCanonicalQueryLanguage()
      Overrides:
      getCanonicalQueryLanguage in class JRAbstractQueryExecuter
    • createDatasource

      public JRDataSource createDatasource() throws JRException
      Throws:
      JRException
    • createResultDatasource

      protected JRDataSource createResultDatasource()
      Creates a data source out of the query result.
      Returns:
      the data source
    • createQuery

      protected void createQuery(String queryString)
      Creates the Hibernate query object.

      Parameters:
      queryString - the query string
    • setParameters

      protected void setParameters()
      Binds values for all the query parameters.
    • setParameter

      protected void setParameter(JRValueParameter parameter)
      Binds a parameter value to a query parameter.
      Parameters:
      parameter - the report parameter
    • close

      public void close()
      Closes the scrollable result when scroll execution type is used.
    • closeScrollableResults

      public void closeScrollableResults()
      Closes the scrollable results of the query.
    • closeResultsStream

      protected void closeResultsStream()
    • cancelQuery

      public boolean cancelQuery() throws JRException
      Throws:
      JRException
    • getParameterReplacement

      protected String getParameterReplacement(String parameterName)
      Specified by:
      getParameterReplacement in class JRAbstractQueryExecuter
    • getHqlParameterName

      protected String getHqlParameterName(String parameterName)
    • getDataset

      public JRDataset getDataset()
      Returns the dataset for which the query executer has been created.
      Returns:
      the dataset for which the query executer has been created
    • list

      public List<jakarta.persistence.Tuple> list()
      Runs the query by calling org.hibernate.Query.list().

      All the result rows are returned.

      Returns:
      the result of the query as a list
    • setQueryRunning

      protected void setQueryRunning(boolean queryRunning)
    • list

      public List<jakarta.persistence.Tuple> list(int firstIndex, int resultCount)
      Returns a page of the query results by calling org.hibernate.Query.iterate().
      Parameters:
      firstIndex - the index of the first row to return
      resultCount - the number of rows to return
      Returns:
      result row list
    • stream

      public Stream<jakarta.persistence.Tuple> stream()
      Runs the query by calling org.hibernate.Query.iterate().
      Returns:
      query iterator
    • scroll

      public org.hibernate.ScrollableResults<jakarta.persistence.Tuple> scroll()
      Runs the query by calling org.hibernate.Query.scroll().
      Returns:
      scrollable results of the query
    • getSession

      protected org.hibernate.Session getSession()
    • clearCache

      public void clearCache()