Class Search
-
Method Summary
Modifier and TypeMethodDescriptionstatic SearchMappingmapping(jakarta.persistence.EntityManagerFactory entityManagerFactory) Retrieve theSearchMappingfrom a JPAEntityManagerFactory.static SearchMappingmapping(SessionFactory sessionFactory) Retrieve theSearchMappingfrom a Hibernate ORMSessionFactory.static SearchSessionsession(jakarta.persistence.EntityManager entityManager) Retrieve theSearchSessionfrom a JPAEntityManager.static SearchSessionRetrieve theSearchSessionfrom a Hibernate ORMSession.static <H> jakarta.persistence.TypedQuery<H>toJpaQuery(SearchQuery<H> searchQuery) Convert aSearchQueryto aJPA query.static <H> Query<H>toOrmQuery(SearchQuery<H> searchQuery) Convert aSearchQueryto aHibernate ORM query.
-
Method Details
-
mapping
Retrieve theSearchMappingfrom a Hibernate ORMSessionFactory.- Parameters:
sessionFactory- A Hibernate ORM session factory.- Returns:
- The corresponding
SearchSession. - Throws:
SearchException- if the session NOTSharedSessionContract.isOpen().
-
mapping
Retrieve theSearchMappingfrom a JPAEntityManagerFactory.- Parameters:
entityManagerFactory- A JPA entity manager factory.- Returns:
- The corresponding
SearchSession. - Throws:
SearchException- if the session NOTSharedSessionContract.isOpen().
-
session
Retrieve theSearchSessionfrom a Hibernate ORMSession.The resulting instance depends on the passed
Session: closing theSessionwill close theSearchSession. TheSearchSessionwill share theSession's persistence context.- Parameters:
session- A Hibernate ORM session.- Returns:
- The corresponding
SearchSession. - Throws:
SearchException- if the session NOTSharedSessionContract.isOpen().
-
session
Retrieve theSearchSessionfrom a JPAEntityManager.The resulting instance depends on the passed
EntityManager: closing theEntityManagerwill close theSearchSession. TheSearchSessionwill share theEntityManager's persistence context.- Parameters:
entityManager- A JPA entity manager.- Returns:
- The corresponding
SearchSession. - Throws:
SearchException- if the entity manager NOTEntityManager.isOpen().
-
toJpaQuery
Convert aSearchQueryto aJPA query.Note that the resulting query does not support all operations and may behave slightly differently from what is expected from a
TypedQueryin some cases (including, but not limited to, the type of thrown exceptions). For these reasons, it is recommended to only use this method when absolutely required, for example when integrating to an external library that expects JPA queries.- Type Parameters:
H- The type of query hits.- Parameters:
searchQuery- The search query to convert.- Returns:
- A representation of the given query as a JPA query.
-
toOrmQuery
Convert aSearchQueryto aHibernate ORM query.Note that the resulting query does not support all operations and may behave slightly differently from what is expected from a
Queryin some cases (including, but not limited to, the type of thrown exceptions). For these reasons, it is recommended to only use this method when absolutely required, for example when integrating to an external library that expects Hibernate ORM queries.- Type Parameters:
H- The type of query hits.- Parameters:
searchQuery- The search query to convert.- Returns:
- A representation of the given query as a Hibernate ORM query.
-