public PropertyPath append(String property) { return new PropertyPath( this, property ); }
public CollectionFetchableIndexCompositeGraph( CollectionReference collectionReference, ExpandingCompositeQuerySpace compositeQuerySpace) { super( compositeQuerySpace, false, collectionReference.getPropertyPath().append( "<index>" ) ); this.collectionReference = collectionReference; }
private String extractFullPath(PropertyPath path) { return path == null ? "<no-path>" : path.getFullPath(); }
private void visitCollectionIndex(CollectionDefinition collectionDefinition) { final CollectionIndexDefinition collectionIndexDefinition = collectionDefinition.getIndexDefinition(); if ( collectionIndexDefinition == null ) { return; } strategy.startingCollectionIndex( collectionIndexDefinition ); try { log.debug( "Visiting index for collection : " + currentPropertyPath.getFullPath() ); currentPropertyPath = currentPropertyPath.append( "<index>" ); try { final Type collectionIndexType = collectionIndexDefinition.getType(); if ( collectionIndexType.isAnyType() ) { visitAnyDefinition( collectionIndexDefinition.toAnyMappingDefinition() ); } else if ( collectionIndexType.isComponentType() ) { visitCompositeDefinition( collectionIndexDefinition.toCompositeDefinition() ); } else if ( collectionIndexType.isAssociationType() ) { visitEntityDefinition( collectionIndexDefinition.toEntityDefinition() ); } } finally { currentPropertyPath = currentPropertyPath.getParent(); } } finally { strategy.finishingCollectionIndex( collectionIndexDefinition ); } }
private void visitAttributeDefinition(AttributeDefinition attributeDefinition, AbstractEntityPersister sourcePersister) { final PropertyPath subPath = currentPropertyPath.append( attributeDefinition.getName() ); log.debug( "Visiting attribute path : " + subPath.getFullPath() ); final AssociationKey associationKey = associationAttributeDefinition.getAssociationKey(); if ( isDuplicateAssociationKey( associationKey ) ) { log.debug( "Property path deemed to be circular : " + subPath.getFullPath() ); strategy.foundCircularAssociation( associationAttributeDefinition );
protected JoinType getJoinType( OuterJoinLoadable persister, PropertyPath path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth) throws MappingException { JoinType joinType = super.getJoinType( persister, path, propertyNumber, associationType, metadataFetchMode, metadataCascadeStyle, lhsTable, lhsColumns, nullable, currentDepth ); //we can use an inner join for the many-to-many if ( joinType==JoinType.LEFT_OUTER_JOIN && path.isRoot() ) { joinType=JoinType.INNER_JOIN; } return joinType; }
attributeDefinition ); currentPropertyPath = currentPropertyPath.getParent();
protected JoinType getJoinType( OuterJoinLoadable persister, PropertyPath path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth) throws MappingException { JoinType joinType = super.getJoinType( persister, path, propertyNumber, associationType, metadataFetchMode, metadataCascadeStyle, lhsTable, lhsColumns, nullable, currentDepth ); //we can use an inner join for the many-to-many if ( joinType==JoinType.LEFT_OUTER_JOIN && path.isRoot() ) { joinType=JoinType.INNER_JOIN; } return joinType; }
@Override protected boolean hasRestriction(PropertyPath path) { return translator.hasRestriction( path.getFullPath() ); } }
public CollectionFetchableElementCompositeGraph( CollectionReference collectionReference, ExpandingCompositeQuerySpace compositeQuerySpace) { super( compositeQuerySpace, false, // these property paths are just informational... collectionReference.getPropertyPath().append( "<element>" ) ); this.collectionReference = collectionReference; }
public static OuterJoinableAssociation createRoot( AssociationType joinableType, String alias, SessionFactoryImplementor factory) { return new OuterJoinableAssociation( new PropertyPath(), joinableType, null, null, alias, JoinType.LEFT_OUTER_JOIN, null, false, factory, Collections.EMPTY_MAP ); }
protected JoinType getJoinType( OuterJoinLoadable persister, PropertyPath path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth) throws MappingException { JoinType joinType = super.getJoinType( persister, path, propertyNumber, associationType, metadataFetchMode, metadataCascadeStyle, lhsTable, lhsColumns, nullable, currentDepth ); //we can use an inner join for the many-to-many if ( joinType==JoinType.LEFT_OUTER_JOIN && path.isRoot() ) { joinType=JoinType.INNER_JOIN; } return joinType; }
@Override protected String getWithClause(PropertyPath path) { return translator.getWithClause( path.getFullPath() ); }
public CollectionFetchableIndexAnyGraph(CollectionReference collectionReference) { super( // this property path is just informational... collectionReference.getPropertyPath().append( "<index>" ) ); this.collectionReference = collectionReference; }
/** * For a collection role, return a list of associations to be fetched by outerjoin */ protected final void walkCollectionTree(QueryableCollection persister, String alias) throws MappingException { walkCollectionTree( persister, alias, new PropertyPath(), 0 ); //TODO: when this is the entry point, we should use an INNER_JOIN for fetching the many-to-many elements! }
public PropertyPath(PropertyPath parent, String property) { this.parent = parent; this.property = property; // the _identifierMapper is a "hidden" property on entities with composite keys. // concatenating it will prevent the path from correctly being used to look up // various things such as criteria paths and fetch profile association paths if ( IDENTIFIER_MAPPER_PROPERTY.equals( property ) ) { this.fullPath = parent != null ? parent.getFullPath() : ""; } else { final String prefix; if ( parent != null ) { final String resolvedParent = parent.getFullPath(); if ( StringHelper.isEmpty( resolvedParent ) ) { prefix = ""; } else { prefix = resolvedParent + '.'; } } else { prefix = ""; } this.fullPath = prefix + property; } }
public CollectionFetchableIndexEntityGraph( CollectionReference collectionReference, ExpandingEntityQuerySpace entityQuerySpace) { super( entityQuerySpace, collectionReference.getPropertyPath().append( "<index>" ) ); this.collectionReference = collectionReference; }
/** * Walk the association tree for an entity, adding associations which should * be join fetched to the {@link #associations} inst var. This form is the * entry point into the walking for a given entity, starting the recursive * calls into {@link #walkEntityTree(org.hibernate.persister.entity.OuterJoinLoadable, String, PropertyPath, int)}. * * @param persister The persister representing the entity to be walked. * @param alias The (root) alias to use for this entity/persister. * * @throws org.hibernate.MappingException ??? */ protected final void walkEntityTree( OuterJoinLoadable persister, String alias) throws MappingException { walkEntityTree( persister, alias, new PropertyPath(), 0 ); }
private String extractDetails(CompositeFetch compositeFetch) { return String.format( "%s(composite=%s, querySpaceUid=%s, path=%s)", compositeFetch.getClass().getSimpleName(), compositeFetch.getFetchedType().getReturnedClass().getName(), compositeFetch.getQuerySpaceUid(), compositeFetch.getPropertyPath().getFullPath() ); }
public CollectionFetchableElementAnyGraph(CollectionReference collectionReference) { super( // this property path is just informational... collectionReference.getPropertyPath().append( "<element>" ) ); this.collectionReference = collectionReference; }