Class JRHibernateQueryExecuter

  • All Implemented Interfaces:
    JRQueryExecuter

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

      • getCanonicalQueryLanguage

        protected String getCanonicalQueryLanguage()
        Description copied from class: JRAbstractQueryExecuter
        Returns a canonical query language for this query executer implementation.

        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.

        Overrides:
        getCanonicalQueryLanguage in class JRAbstractQueryExecuter
        Returns:
        a canonical query language
      • 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.

        If the value of the PARAMETER_HIBERNATE_FILTER_COLLECTION is not null, then a filter query is created using the value of the parameter as the collection.

        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.
      • cancelQuery

        public boolean cancelQuery()
                            throws JRException
        Description copied from interface: JRQueryExecuter
        Cancels the query if it's currently running.

        This method will be called from a different thread if the client decides to cancel the filling process.

        Returns:
        true if and only if the query was running and it has been canceled
        Throws:
        JRException
      • getHqlParameterName

        protected String getHqlParameterName​(String parameterName)
      • getReturnTypes

        public org.hibernate.type.Type[] getReturnTypes()
        Returns the return types of the HQL query.
        Returns:
        the return types of the HQL query
      • getReturnAliases

        public String[] getReturnAliases()
        Returns the aliases of the HQL query.
        Returns:
        the aliases of the HQL query
      • 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<?> 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<?> 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
      • iterate

        public Iterator<?> iterate()
        Runs the query by calling org.hibernate.Query.iterate().
        Returns:
        query iterator
      • scroll

        public org.hibernate.ScrollableResults scroll()
        Runs the query by calling org.hibernate.Query.scroll().
        Returns:
        scrollable results of the query
      • clearCache

        public void clearCache()