Class AbstractRelationQueryGenerator
- java.lang.Object
-
- org.hibernate.envers.internal.entities.mapper.relation.query.AbstractRelationQueryGenerator
-
- All Implemented Interfaces:
RelationQueryGenerator
- Direct Known Subclasses:
OneAuditEntityQueryGenerator
,OneEntityQueryGenerator
,ThreeEntityQueryGenerator
,TwoEntityOneAuditedQueryGenerator
,TwoEntityQueryGenerator
public abstract class AbstractRelationQueryGenerator extends Object implements RelationQueryGenerator
Base class for implementers ofRelationQueryGenerator
contract.
-
-
Field Summary
Fields Modifier and Type Field Description protected AuditStrategy
auditStrategy
protected Configuration
configuration
protected String
entityName
protected String
orderByCollectionRole
protected MiddleIdData
referencingIdData
protected boolean
revisionTypeInId
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRelationQueryGenerator(Configuration configuration, String entityName, MiddleIdData referencingIdData, boolean revisionTypeInId, String orderByCollectionRole)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
applyValidAndRemovePredicates(QueryBuilder qb)
Apply predicates to fetch data and deletions that took place during the same revision.protected abstract void
applyValidPredicates(QueryBuilder qb, Parameters parameters, boolean inclusive)
Apply predicates used to fetch actual data.protected abstract QueryBuilder
buildQueryBuilderCommon(SessionFactoryImplementor sessionFactory)
Build the common aspects of aQueryBuilder
used by both query and query-remove strings.Query
getQuery(SharedSessionContractImplementor session, Object primaryKey, Number revision, boolean removed)
Return the query to fetch the relation.protected String
getRevisionTypePath()
-
-
-
Field Detail
-
configuration
protected final Configuration configuration
-
auditStrategy
protected final AuditStrategy auditStrategy
-
referencingIdData
protected final MiddleIdData referencingIdData
-
revisionTypeInId
protected final boolean revisionTypeInId
-
entityName
protected final String entityName
-
orderByCollectionRole
protected final String orderByCollectionRole
-
-
Constructor Detail
-
AbstractRelationQueryGenerator
protected AbstractRelationQueryGenerator(Configuration configuration, String entityName, MiddleIdData referencingIdData, boolean revisionTypeInId, String orderByCollectionRole)
-
-
Method Detail
-
getQuery
public Query getQuery(SharedSessionContractImplementor session, Object primaryKey, Number revision, boolean removed)
Description copied from interface:RelationQueryGenerator
Return the query to fetch the relation.- Specified by:
getQuery
in interfaceRelationQueryGenerator
- Parameters:
session
- The session.primaryKey
- The primary key of the owning object.revision
- The revision to be fetched.removed
- Whether to return a query that includes the removed audit rows.
-
buildQueryBuilderCommon
protected abstract QueryBuilder buildQueryBuilderCommon(SessionFactoryImplementor sessionFactory)
Build the common aspects of aQueryBuilder
used by both query and query-remove strings.- Parameters:
sessionFactory
- The session factory.- Returns:
- The constructed query builder instance.
-
applyValidPredicates
protected abstract void applyValidPredicates(QueryBuilder qb, Parameters parameters, boolean inclusive)
Apply predicates used to fetch actual data.- Parameters:
qb
- The query builder instance to apply predicates against.parameters
- The root query parametersinclusive
- Whether its inclusive or not.
-
applyValidAndRemovePredicates
protected abstract void applyValidAndRemovePredicates(QueryBuilder qb)
Apply predicates to fetch data and deletions that took place during the same revision.- Parameters:
qb
- The query builder instance to apply predicates against.
-
getRevisionTypePath
protected String getRevisionTypePath()
-
-