private boolean isBag(CollectionPersister collectionPersister) { return collectionPersister.getCollectionType().getClass().isAssignableFrom( BagType.class ); }
@Override public void beforeInitialize(CollectionPersister persister, int anticipatedSize) { this.map = (Map) persister.getCollectionType().instantiate( anticipatedSize ); }
@Override public void beforeInitialize(CollectionPersister persister, int anticipatedSize) { this.bag = (List) persister.getCollectionType().instantiate( anticipatedSize ); }
@Override public void beforeInitialize(CollectionPersister persister, int anticipatedSize) { this.set = (Set) persister.getCollectionType().instantiate( anticipatedSize ); }
@Override public void beforeInitialize(CollectionPersister persister, int anticipatedSize) { this.list = (List) persister.getCollectionType().instantiate( anticipatedSize ); }
/** * This version is slightly different for say * {@link org.hibernate.type.CollectionType#getKeyOfOwner} in that here we * need to assume that the owner is not yet associated with the session, * and thus we cannot rely on the owner's EntityEntry snapshot... * * @param role The persister for the collection role being processed. * * @return The value from the owner that identifies the grouping into the collection */ final Serializable extractCollectionKeyFromOwner(CollectionPersister role) { if ( role.getCollectionType().useLHSPrimaryKey() ) { return ownerIdentifier; } return (Serializable) role.getOwnerEntityPersister().getPropertyValue( owner, role.getCollectionType().getLHSPropertyName() ); } }
private boolean isFoundInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent) { final Object collection = persister.getPropertyValue( potentialParent, property ); return collection != null && Hibernate.isInitialized( collection ) && collectionPersister.getCollectionType().contains( collection, childEntity, session ); }
private Object getIndexInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent){ final Object collection = persister.getPropertyValue( potentialParent, property ); if ( collection != null && Hibernate.isInitialized( collection ) ) { return collectionPersister.getCollectionType().indexOf( collection, childEntity ); } else { return null; } }
protected Serializable findCollectionOwnerKey(ResultSetProcessingContextImpl context) { Object owner = context.getOwnerProcessingState( (Fetch) collectionReference ).getEntityInstance(); return collectionReference.getCollectionPersister().getCollectionType().getKeyOfOwner( owner, context.getSession() ); }
/** * Get the ID for the entity that owned this persistent collection when it was loaded * * @param ce The collection entry * @return the owner ID if available from the collection's loaded key; otherwise, returns null */ private Serializable getLoadedCollectionOwnerIdOrNull(CollectionEntry ce) { if ( ce == null || ce.getLoadedKey() == null || ce.getLoadedPersister() == null ) { return null; } // TODO: an alternative is to check if the owner has changed; if it hasn't then // get the ID from collection.getOwner() return ce.getLoadedPersister().getCollectionType().getIdOfOwnerOrNull( ce.getLoadedKey(), session ); }
protected Serializable getCollectionKey( CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session) { final CollectionType collectionType = persister.getCollectionType(); if ( ownerEntry != null ) { // this call only works when the owner is associated with the Session, which is not always the case return collectionType.getKeyOfOwner( owner, session ); } if ( collectionType.getLHSPropertyName() == null ) { // collection key is defined by the owning entity identifier return persister.getOwnerEntityPersister().getIdentifier( owner, session ); } else { return (Serializable) persister.getOwnerEntityPersister().getPropertyValue( owner, collectionType.getLHSPropertyName() ); } }
key = collectionPersister.getCollectionType().getKeyOfOwner( owner, session );
final CollectionType collectionType = collectionPersister.getCollectionType();
collection = persister.getCollectionType().instantiate( loadContexts.getPersistenceContext().getSession(), persister, key );
if ( persister.getCollectionType().hasHolder() ) { getLoadContext().getPersistenceContext().addCollectionHolder( lce.getCollection() );
@Override public PersistentCollectionType getCollectionType() { return (PersistentCollectionType) TypeV2Adapter.adapt(persister.getCollectionType()); }
public void beforeInitialize(CollectionPersister persister, int anticipatedSize) { this.set = ( Set ) persister.getCollectionType().instantiate( anticipatedSize ); }
public void beforeInitialize(CollectionPersister persister, int anticipatedSize) { this.set = ( Set ) persister.getCollectionType().instantiate( anticipatedSize ); }
private boolean isFoundInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent) { Object collection = persister.getPropertyValue( potentialParent, property ); return collection != null && Hibernate.isInitialized( collection ) && collectionPersister.getCollectionType().contains( collection, childEntity, session ); }
private boolean isFoundInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent) { Object collection = persister.getPropertyValue( potentialParent, property ); return collection != null && Hibernate.isInitialized( collection ) && collectionPersister.getCollectionType().contains( collection, childEntity, session ); }