public interface JpaProvider
Modifier and Type | Interface and Description |
---|---|
static class |
JpaProvider.ConstraintType
The possible locations of a constraint.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsEntity(javax.persistence.EntityManager em,
Class<?> entityClass,
Object id)
Returns whether the entity with the id is contained in the entity managers persistence context.
|
String |
escapeCharacter(char character)
The given escape character for a LIKE predicate as string.
|
String |
getBooleanConditionalExpression(boolean value)
The JPQL conditional expression to use for the given literal boolean value.
|
String |
getBooleanExpression(boolean value)
The JPQL expression to use for the given literal boolean value.
|
String |
getCollectionValueFunction()
Normally returns
VALUE , but since Hibernate does weird things when using that, it returns null . |
String[] |
getColumnNames(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
Returns the column names of the attribute of the given entity type.
|
String[] |
getColumnTypes(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
Returns the SQL column type names of the given attribute of the given entity type.
|
String |
getCustomFunctionInvocation(String functionName,
int argumentCount)
Returns the start of a JPQL representation of a function invocation for the given function name and argument count.
|
Class<?> |
getDefaultQueryResultType()
The default result type of a scalar query.
|
JoinTable |
getJoinTable(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
If the given attribute is a collection that uses a join table, returns it's descriptor.
|
String |
getMappedBy(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
If the given attribute is an inverse collection, the mapped by attribute name is returned.
|
String |
getNullExpression()
The JPQL expression to use for the NULL literal.
|
String |
getOnClause()
The name of the clause that has the same semantics as the ON clause which was introduced in JPA 2.1.
|
Map<String,String> |
getWritableMappedByMappings(javax.persistence.metamodel.EntityType<?> inverseType,
javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
If the given attribute is insertable = false and updatable = false it returns the writable mappings for the inverse type.
|
boolean |
isBag(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
Whether the given attribute is a non-indexed and non-ordered collection a.k.a. a bag.
|
boolean |
isColumnShared(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
Whether columns for the given attribute are shared between multiple subtypes
or shared by occupying the same slot in the resulting SQL.
|
boolean |
isDeleteCascaded(javax.persistence.metamodel.ManagedType<?> ownerType,
String attributeName)
Whether delete cascading is activated for the given attribute.
|
boolean |
isForeignJoinColumn(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName)
Whether the join columns for the given attribute are in a foreign table.
|
boolean |
isOrphanRemoval(javax.persistence.metamodel.ManagedType<?> ownerType,
String attributeName)
Whether orphan removal is activated for the given attribute.
|
boolean |
needsAssociationToIdRewriteInOnClause()
Indicates if the provider needs associations in the ON clause to use their id.
|
boolean |
needsBracketsForListParamter()
Whether brackets are needed around a list parameter.
|
boolean |
needsBrokenAssociationToIdRewriteInOnClause()
Indicates if the provider needs associations in the ON clause to use their id.
|
boolean |
needsJoinSubqueryRewrite()
Returns whether key restricted left joins should be rewritten to subquery joins.
|
boolean |
needsTypeConstraintForColumnSharing()
Indicates if the provider does column sharing for same named columns in inheritance mappings
and thus requires the use of a CASE WHEN expression for restricting casted accesses like e.g.
|
void |
renderNullPrecedence(StringBuilder sb,
String expression,
String resolvedExpression,
String order,
String nulls)
Renders the null precedence into the given string builder.
|
JpaProvider.ConstraintType |
requiresTreatFilter(javax.persistence.metamodel.EntityType<?> ownerType,
String attributeName,
JoinType joinType)
Returns where to put treat filters for a treat joined association of this attribute.
|
void |
setCacheable(javax.persistence.Query query)
Enables query result caching for the given query.
|
boolean |
supportsCollectionTableCleanupOnDelete()
Indicates whether the provider clears collection table entries on bulk delete operations.
|
boolean |
supportsCollectionValueDereference()
Whether dereferencing a VALUE function expression is supported by the JPA provider.
|
boolean |
supportsCountStar()
Whether the
COUNT(*) syntax is supported. |
boolean |
supportsEntityJoin()
Whether Entity Joins are supported.
|
boolean |
supportsForeignAssociationInOnClause()
Indicates if the provider supports the use of foreign associations in the ON clause.
|
boolean |
supportsInsertStatement()
Whether Insert statements are supported.
|
boolean |
supportsJoinTableCleanupOnDelete()
Indicates whether the provider clears join table entries on bulk delete operations.
|
boolean |
supportsJpa21()
Whether JPA 2.1 specification is supported.
|
boolean |
supportsNullPrecedenceExpression()
Whether the query language supports the null precedence clause.
|
boolean |
supportsRootTreat()
Whether treating a from/root alias is supported.
|
boolean |
supportsRootTreatJoin()
Whether a root treat in a join is supported.
|
boolean |
supportsRootTreatTreatJoin()
Whether a root treat in a treat join is supported.
|
boolean |
supportsSingleValuedAssociationIdExpressions()
Indicates if the provider supports expressions like
doc.owner.id
without generating an extra join.
|
boolean |
supportsSubtypePropertyResolving()
Whether properties accessed of a from node are implicitly resolved to properties of a subtype of the from node.
|
boolean |
supportsSubtypeRelationResolving()
Whether relations of a from node in joins are implicitly resolved to the relations of a subtype of the from node.
|
boolean |
supportsTransientEntityAsParameter()
Indicates if the provider supports the use of transient entity objects as parameters.
|
boolean |
supportsTreatCorrelation()
Whether a correlation path with a treat expression is supported.
|
boolean |
supportsTreatJoin()
Whether a treat join is supported.
|
boolean |
supportsUpdateSetEmbeddable()
Indicates whether an embeddable can be set via an update queries SET clause.
|
boolean supportsJpa21()
boolean supportsEntityJoin()
boolean supportsInsertStatement()
boolean needsBracketsForListParamter()
boolean needsJoinSubqueryRewrite()
String getBooleanExpression(boolean value)
value
- The boolean valueString getBooleanConditionalExpression(boolean value)
value
- The boolean valueString getNullExpression()
String getOnClause()
String getCollectionValueFunction()
VALUE
, but since Hibernate does weird things when using that, it returns null
.
Returning null results in omitting VALUE
in the final query that is passed to the JPA provider.boolean supportsCollectionValueDereference()
Class<?> getDefaultQueryResultType()
String getCustomFunctionInvocation(String functionName, int argumentCount)
FUNCTION('functionName',
but implementations may also allow to render the function name directly.functionName
- The function nameargumentCount
- The number of the arguments that the function is invoked withString escapeCharacter(char character)
character
- The escape characterboolean supportsNullPrecedenceExpression()
void renderNullPrecedence(StringBuilder sb, String expression, String resolvedExpression, String order, String nulls)
sb
- The builder to which the null precedence should be appended toexpression
- The order by expression which might be a select aliasresolvedExpression
- The resolved expression for a possible select alias or the expressionorder
- The order as string (ASC
or DESC
)nulls
- The null precedence as string (NULLS FIRST
or NULLS LAST
)boolean supportsRootTreat()
SELECT TREAT(alias AS Subtype).property FROM ..
boolean supportsTreatJoin()
SELECT ... FROM .. JOIN TREAT(alias.relation AS Subtype)
boolean supportsTreatCorrelation()
SELECT (SELECT .. FROM TREAT(parent AS Subtype).relation) FROM ..
boolean supportsRootTreatJoin()
SELECT ... FROM .. JOIN TREAT(alias AS Subtype).relation
boolean supportsRootTreatTreatJoin()
SELECT ... FROM .. JOIN TREAT(TREAT(alias AS Subtype).relation AS Subtype)
boolean supportsSubtypePropertyResolving()
boolean supportsSubtypeRelationResolving()
boolean supportsCountStar()
COUNT(*)
syntax is supported.COUNT(*)
syntax is supported, false otherwiseboolean isForeignJoinColumn(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The owner of the attributeattributeName
- The attribute name to checkboolean isColumnShared(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The owner of the attributeattributeName
- The attribute name to checkString[] getColumnNames(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The owner of the attributeattributeName
- The attribute nameString[] getColumnTypes(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The owner of the attributeattributeName
- The attribute nameJpaProvider.ConstraintType requiresTreatFilter(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName, JoinType joinType)
ownerType
- The declaring type of the attribute to checkattributeName
- The attribute name for which to check the treat filter requirement or nulljoinType
- The join type used for the treat joinString getMappedBy(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The declaring type of the attribute to checkattributeName
- The name of the inverse attribute for which to retrieve the mapped by valueMap<String,String> getWritableMappedByMappings(javax.persistence.metamodel.EntityType<?> inverseType, javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
inverseType
- The type containing the inverse relationownerType
- The declaring type of the attribute to checkattributeName
- The name of the attribute for which to retrieve the writable mapped by mappingJoinTable getJoinTable(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The declaring type of the attribute to checkattributeName
- The name of the attribute for which to retrieve the join table nameboolean isBag(javax.persistence.metamodel.EntityType<?> ownerType, String attributeName)
ownerType
- The declaring type of the attribute to checkattributeName
- The name of the attribute to checkboolean isOrphanRemoval(javax.persistence.metamodel.ManagedType<?> ownerType, String attributeName)
ownerType
- The declaring type of the attribute to checkattributeName
- The name of the attribute to checkboolean isDeleteCascaded(javax.persistence.metamodel.ManagedType<?> ownerType, String attributeName)
ownerType
- The declaring type of the attribute to checkattributeName
- The name of the attribute to checkboolean containsEntity(javax.persistence.EntityManager em, Class<?> entityClass, Object id)
em
- The entity managerentityClass
- The entity classid
- The entity idboolean supportsSingleValuedAssociationIdExpressions()
boolean supportsForeignAssociationInOnClause()
alias.association.property
results in a subquery or table group join
when used in the ON clause, the JPA provider supports this feature. Normally this silently fails with invalid SQL.
By returning false, subqueries will be generated for such associations instead.
The value is not yet used but will be in a future version. Also see: https://github.com/Blazebit/blaze-persistence/issues/402boolean supportsUpdateSetEmbeddable()
boolean supportsTransientEntityAsParameter()
boolean needsAssociationToIdRewriteInOnClause()
alias.association
in the ON clause is rewritten to
alias.association.id
.boolean needsBrokenAssociationToIdRewriteInOnClause()
alias.association
in the ON clause is rewritten to
alias.association.id
which relies on a broken type check in older Hibernate versions.boolean needsTypeConstraintForColumnSharing()
TREAT(alias AS Subtype).property
to retain cast semantics.boolean supportsCollectionTableCleanupOnDelete()
boolean supportsJoinTableCleanupOnDelete()
void setCacheable(javax.persistence.Query query)
query
- Enables query result caching for the queryCopyright © 2014–2018 Blazebit. All rights reserved.