public final class Search extends Object
| Modifier and Type | Method and Description |
|---|---|
static SearchMapping |
mapping(javax.persistence.EntityManagerFactory entityManagerFactory)
Retrieve the
SearchMapping from a JPA EntityManagerFactory. |
static SearchMapping |
mapping(SessionFactory sessionFactory)
Retrieve the
SearchMapping from a Hibernate ORM SessionFactory. |
static SearchSession |
session(javax.persistence.EntityManager entityManager)
Retrieve the
SearchSession from a JPA EntityManager. |
static SearchSession |
session(Session session)
Retrieve the
SearchSession from a Hibernate ORM Session. |
static <H> javax.persistence.TypedQuery<H> |
toJpaQuery(SearchQuery<H> searchQuery)
Convert a
SearchQuery to a JPA query. |
static <H> Query<H> |
toOrmQuery(SearchQuery<H> searchQuery)
Convert a
SearchQuery to a Hibernate ORM query. |
public static SearchMapping mapping(SessionFactory sessionFactory)
SearchMapping from a Hibernate ORM SessionFactory.sessionFactory - A Hibernate ORM session factory.SearchSession.SearchException - if the session NOT SharedSessionContract.isOpen().public static SearchMapping mapping(javax.persistence.EntityManagerFactory entityManagerFactory)
SearchMapping from a JPA EntityManagerFactory.entityManagerFactory - A JPA entity manager factory.SearchSession.SearchException - if the session NOT SharedSessionContract.isOpen().public static SearchSession session(Session session)
SearchSession from a Hibernate ORM Session.
The resulting instance depends on the passed Session:
closing the Session will close the SearchSession.
The SearchSession will share the Session's persistence context.
session - A Hibernate ORM session.SearchSession.SearchException - if the session NOT SharedSessionContract.isOpen().public static SearchSession session(javax.persistence.EntityManager entityManager)
SearchSession from a JPA EntityManager.
The resulting instance depends on the passed EntityManager:
closing the EntityManager will close the SearchSession.
The SearchSession will share the EntityManager's persistence context.
entityManager - A JPA entity manager.SearchSession.SearchException - if the entity manager NOT EntityManager.isOpen().public static <H> javax.persistence.TypedQuery<H> toJpaQuery(SearchQuery<H> searchQuery)
SearchQuery to a JPA query.
Note that the resulting query does not support all operations
and may behave slightly differently from what is expected from a TypedQuery in 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.
H - The type of query hits.searchQuery - The search query to convert.public static <H> Query<H> toOrmQuery(SearchQuery<H> searchQuery)
SearchQuery to a Hibernate ORM query.
Note that the resulting query does not support all operations
and may behave slightly differently from what is expected from a Query in 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.
H - The type of query hits.searchQuery - The search query to convert.Copyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.