Class QueryUtil


  • public class QueryUtil
    extends java.lang.Object
    Utility methods for manipulating JPA and Hibernate query objects.
    Since:
    14.2.0
    Version:
    $Revision$ $Date$
    • Method Detail

      • addDummyQuerySpace

        public static javax.persistence.Query addDummyQuerySpace​(javax.persistence.Query query)
        Adds a dummy query space to a JPA query created with EntityManager.createNativeQuery(java.lang.String). This is used to prevent the default behavior of the execution of a change SQL to invalidate all hibernate cache.
        Parameters:
        query - the query object.
        Returns:
        the query object given.
        Since:
        14.2.0
      • addDummyQuerySpace

        public static org.hibernate.SQLQuery addDummyQuerySpace​(org.hibernate.SQLQuery query)
        Adds a dummy query space to a SQLQuery. This is used to prevent the default behavior of the execution of a change SQL to invalidate all hibernate cache.
        Parameters:
        query - the query object.
        Returns:
        the query object given.
        Since:
        14.2.0
      • createSQLQueryWithDQS

        public static org.hibernate.SQLQuery createSQLQueryWithDQS​(java.lang.String sqlString)
        Creates a SQLQuery using the current transaction and adds a dummy query space to it.

        This is used to create a bulk change query that will not invalidate all hibernate cache.

        Parameters:
        sqlString - the SQL.
        Returns:
        the query.
        Since:
        14.2.0
      • createSQLQueryWithDQS

        public static org.hibernate.SQLQuery createSQLQueryWithDQS​(org.hibernate.Session session,
                                                                   java.lang.String sqlString)
        Creates a SQLQuery using the given session and adds a dummy query space to it.

        This is used to create a bulk change query that will not invalidate all hibernate cache.

        Parameters:
        session - the Hibernate session.
        sqlString - the SQL.
        Returns:
        the query.
        Since:
        14.2.0
      • createNativeQueryWithDQS

        public static javax.persistence.Query createNativeQueryWithDQS​(java.lang.String sqlString)
        Creates a JPA native query using the current transaction and adds a dummy query space to it.

        This is used to create a bulk change query that will not invalidate all hibernate cache.

        Parameters:
        sqlString - the SQL.
        Returns:
        the query.
        Since:
        14.2.0
      • createNativeQueryWithDQS

        public static javax.persistence.Query createNativeQueryWithDQS​(javax.persistence.EntityManager em,
                                                                       java.lang.String sqlString)
        Creates a JPA native query using the given entity manager and adds a dummy query space to it.

        This is used to create a bulk change query that will not invalidate all hibernate cache.

        Parameters:
        em - the entity manager.
        sqlString - the SQL.
        Returns:
        the query.
        Since:
        14.2.0