| Modifier and Type | Field and Description |
|---|---|
static String |
PROPERTY_VALIDATION_MODE |
static String |
QUERY_HINT_CACHE_RETRIEVE_MODE |
static String |
QUERY_HINT_CACHE_STORE_MODE |
static String |
QUERY_HINT_FETCH_GRAPH |
static String |
QUERY_HINT_LOAD_GRAPH |
| Modifier and Type | Method and Description |
|---|---|
static Expression<String> |
castAsString(CriteriaBuilder builder,
Expression<?> expression)
Returns a new expression wherein given expression is cast as String.
|
static Expression<String> |
concat(CriteriaBuilder builder,
Object... expressionsOrStrings)
Returns a SQL CONCAT(...) of given expressions or strings.
|
static <T,I> long |
countForeignKeyReferences(EntityManager entityManager,
Class<T> entityType,
Class<I> identifierType,
I id)
Returns count of all foreign key references to entity of given entity type with given ID of given identifier type.
|
static <T> T |
getFirstResultOrNull(Query query)
Returns first result of given query, or
null if there is none. |
static <T> T |
getFirstResultOrNull(TypedQuery<T> typedQuery)
Returns first result of given typed query, or
null if there is none. |
static <T> Optional<T> |
getOptionalFirstResult(Query query)
Returns first result of given query as
Optional. |
static <T> Optional<T> |
getOptionalFirstResult(TypedQuery<T> typedQuery)
Returns first result of given typed query as
Optional. |
static <T> Optional<T> |
getOptionalSingleResult(Query query)
Returns single result of given query as
Optional. |
static <T> Optional<T> |
getOptionalSingleResult(TypedQuery<T> typedQuery)
Returns single result of given typed query as
Optional. |
static <K,T> Map<K,T> |
getResultMap(TypedQuery<T> typedQuery,
Function<? super T,? extends K> keyMapper)
Returns the result list of given typed query as a map mapped by the given key mapper.
|
static <K,T,V> Map<K,V> |
getResultMap(TypedQuery<T> typedQuery,
Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper)
Returns the result list of given typed query as a map mapped by the given key and value mappers.
|
static <T> T |
getSingleResultOrNull(Query query)
Returns single result of given query, or
null if there is none. |
static <T> T |
getSingleResultOrNull(TypedQuery<T> typedQuery)
Returns single result of given typed query, or
null if there is none. |
static ValidationMode |
getValidationMode(EntityManager entityManager)
Returns the currently configured bean validation mode for given entity manager.
|
static boolean |
isEnumeratedByOrdinal(Path<?> path)
Returns whether given path is
Enumerated by EnumType.ORDINAL. |
public static final String QUERY_HINT_LOAD_GRAPH
public static final String QUERY_HINT_FETCH_GRAPH
public static final String QUERY_HINT_CACHE_STORE_MODE
public static final String QUERY_HINT_CACHE_RETRIEVE_MODE
public static final String PROPERTY_VALIDATION_MODE
public static ValidationMode getValidationMode(EntityManager entityManager)
persistence.xml.entityManager - The involved entity manager.public static <T> Optional<T> getOptionalSingleResult(TypedQuery<T> typedQuery)
Optional.T - The generic result type.typedQuery - The involved typed query.Optional.NonUniqueResultException - When there is no unique result.public static <T> Optional<T> getOptionalSingleResult(Query query)
Optional.T - The expected result type.query - The involved query.Optional.NonUniqueResultException - When there is no unique result.ClassCastException - When T is of wrong type.public static <T> T getSingleResultOrNull(TypedQuery<T> typedQuery)
null if there is none.T - The generic result type.typedQuery - The involved typed query.null if there is none.NonUniqueResultException - When there is no unique result.public static <T> T getSingleResultOrNull(Query query)
null if there is none.T - The expected result type.query - The involved query.null if there is none.NonUniqueResultException - When there is no unique result.ClassCastException - When T is of wrong type.public static <T> Optional<T> getOptionalFirstResult(TypedQuery<T> typedQuery)
Optional.T - The generic result type.typedQuery - The involved typed query.Optional.public static <T> Optional<T> getOptionalFirstResult(Query query)
Optional.T - The expected result type.query - The involved query.Optional.ClassCastException - When T is of wrong type.public static <T> T getFirstResultOrNull(TypedQuery<T> typedQuery)
null if there is none.T - The generic result type.typedQuery - The involved typed query.null if there is none.public static <T> T getFirstResultOrNull(Query query)
null if there is none.T - The expected result type.query - The involved query.null if there is none.ClassCastException - When T is of wrong type.public static <K,T> Map<K,T> getResultMap(TypedQuery<T> typedQuery, Function<? super T,? extends K> keyMapper)
K - The generic map key type.T - The generic result type, also map value type.typedQuery - The involved typed query.keyMapper - The key mapper.public static <K,T,V> Map<K,V> getResultMap(TypedQuery<T> typedQuery, Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
K - The generic map key type.T - The generic result type.V - The generic map value type.typedQuery - The involved typed query.keyMapper - The key mapper.valueMapper - The value mapper.public static <T,I> long countForeignKeyReferences(EntityManager entityManager, Class<T> entityType, Class<I> identifierType, I id)
T - The generic result type.I - The generic identifier type.entityManager - The involved entity manager.entityType - Entity type.identifierType - Identifier type.id - Entity ID.public static Expression<String> concat(CriteriaBuilder builder, Object... expressionsOrStrings)
builder - The involved criteria builder.expressionsOrStrings - Expressions or Strings.IllegalArgumentException - When there are less than 2 expressions or strings. There's no point of concat then.public static Expression<String> castAsString(CriteriaBuilder builder, Expression<?> expression)
builder - The involved criteria builder.expression - Expression to be cast as String.public static boolean isEnumeratedByOrdinal(Path<?> path)
Enumerated by EnumType.ORDINAL.path - Path of interest.Enumerated by EnumType.ORDINAL.Copyright © 2015–2018 OmniFaces. All rights reserved.