本文整理汇总了Java中org.hibernate.persister.entity.EntityPersister.getQuerySpaces方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPersister.getQuerySpaces方法的具体用法?Java EntityPersister.getQuerySpaces怎么用?Java EntityPersister.getQuerySpaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.persister.entity.EntityPersister
的用法示例。
在下文中一共展示了EntityPersister.getQuerySpaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BulkOperationCleanupAction
import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
/**
* Constructs an action to cleanup "affected cache regions" based on a
* set of affected table spaces. This differs from {@link #BulkOperationCleanupAction(SessionImplementor, Queryable[])}
* in that here we have the affected <strong>table names</strong>. From those
* we deduce the entity persisters which are affected based on the defined
* {@link EntityPersister#getQuerySpaces() table spaces}; and from there, we
* determine the affected collection regions based on any collections
* in which those entity persisters participate as elements/keys/etc.
*
* @param session The session to which this request is tied.
* @param tableSpaces The table spaces.
*/
@SuppressWarnings({ "unchecked" })
public BulkOperationCleanupAction(SessionImplementor session, Set tableSpaces) {
final LinkedHashSet<String> spacesList = new LinkedHashSet<String>();
spacesList.addAll( tableSpaces );
final SessionFactoryImplementor factory = session.getFactory();
for ( String entityName : factory.getAllClassMetadata().keySet() ) {
final EntityPersister persister = factory.getEntityPersister( entityName );
final String[] entitySpaces = (String[]) persister.getQuerySpaces();
if ( affectedEntity( tableSpaces, entitySpaces ) ) {
spacesList.addAll( Arrays.asList( entitySpaces ) );
if ( persister.hasCache() ) {
entityCleanups.add( new EntityCleanup( persister.getCacheAccessStrategy() ) );
}
if ( persister.hasNaturalIdentifier() && persister.hasNaturalIdCache() ) {
naturalIdCleanups.add( new NaturalIdCleanup( persister.getNaturalIdCacheAccessStrategy() ) );
}
final Set<String> roles = session.getFactory().getCollectionRolesByEntityParticipant( persister.getEntityName() );
if ( roles != null ) {
for ( String role : roles ) {
final CollectionPersister collectionPersister = factory.getCollectionPersister( role );
if ( collectionPersister.hasCache() ) {
collectionCleanups.add(
new CollectionCleanup( collectionPersister.getCacheAccessStrategy() )
);
}
}
}
}
}
this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] );
}
示例2: createEntityJoin
import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
public FromElement createEntityJoin(
String entityClass,
String tableAlias,
JoinSequence joinSequence,
boolean fetchFlag,
boolean inFrom,
EntityType type,
String role,
String joinPath) throws SemanticException {
FromElement elem = createJoin( entityClass, tableAlias, joinSequence, type, false );
elem.setFetch( fetchFlag );
if ( joinPath != null ) {
elem.applyTreatAsDeclarations( fromClause.getWalker().getTreatAsDeclarationsByPath( joinPath ) );
}
EntityPersister entityPersister = elem.getEntityPersister();
int numberOfTables = entityPersister.getQuerySpaces().length;
if ( numberOfTables > 1 && implied && !elem.useFromFragment() ) {
LOG.debug( "createEntityJoin() : Implied multi-table entity join" );
elem.setUseFromFragment( true );
}
// If this is an implied join in a FROM clause, then use ANSI-style joining, and set the
// flag on the FromElement that indicates that it was implied in the FROM clause itself.
if ( implied && inFrom ) {
joinSequence.setUseThetaStyle( false );
elem.setUseFromFragment( true );
elem.setImpliedInFromClause( true );
}
if ( elem.getWalker().isSubQuery() ) {
// two conditions where we need to transform this to a theta-join syntax:
// 1) 'elem' is the "root from-element" in correlated subqueries
// 2) The DotNode.useThetaStyleImplicitJoins has been set to true
// and 'elem' represents an implicit join
if ( elem.getFromClause() != elem.getOrigin().getFromClause() ||
// ( implied && DotNode.useThetaStyleImplicitJoins ) ) {
DotNode.useThetaStyleImplicitJoins ) {
// the "root from-element" in correlated subqueries do need this piece
elem.setType( FROM_FRAGMENT );
joinSequence.setUseThetaStyle( true );
elem.setUseFromFragment( false );
}
}
elem.setRole( role );
return elem;
}