Class HibernateSearch<TYPE>

  • All Implemented Interfaces:
    org.springframework.orm.hibernate5.HibernateCallback<List<TYPE>>

    public final class HibernateSearch<TYPE>
    extends Object
    implements org.springframework.orm.hibernate5.HibernateCallback<List<TYPE>>
    A HibernateCallback that executes an HQLQuery against the database, converting parameters and results to the correct types.

    Construction is via two static methods, depending on the type of query. For user, group and directory queries, use forEntities(long, EntityQuery). For membership queries, use forMemberships(long, MembershipQuery).

    Since:
    7.20.0
    • Method Detail

      • forEntities

        public static <T> HibernateSearch<T> forEntities​(long directoryId,
                                                         com.atlassian.crowd.search.query.entity.EntityQuery<T> query)
        Returns a HibernateSearch instance for a user or group query in a particular directory.
      • forEntities

        public static <T> HibernateSearch<T> forEntities​(com.atlassian.crowd.search.query.entity.EntityQuery<T> query)
        Returns a HibernateSearch instance for a user, group or directory query across all directories. Normally this is only used for searching for directories.
      • forMemberships

        public static <T> HibernateSearch<T> forMemberships​(long directoryId,
                                                            com.atlassian.crowd.search.query.membership.MembershipQuery<T> query)
        Returns a HibernateSearch instance for a membership query in a particular directory.
      • doInHibernate

        public List<TYPE> doInHibernate​(org.hibernate.Session session)
        Specified by:
        doInHibernate in interface org.springframework.orm.hibernate5.HibernateCallback<TYPE>
      • handle

        protected static <T> void handle​(org.hibernate.Session session,
                                         com.atlassian.crowd.search.hibernate.HQLQuery hqlQuery,
                                         org.hibernate.query.Query<T> hibernateQuery,
                                         int maxResults)