@Override public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection) { return getLoadedCollectionOwnerIdOrNull( getCollectionEntry( collection ) ); }
@Override public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection) { final CollectionEntry ce = getCollectionEntry( collection ); if ( ce.getLoadedPersister() == null ) { return null; } Object loadedOwner = null; // TODO: an alternative is to check if the owner has changed; if it hasn't then // return collection.getOwner() final Serializable entityId = getLoadedCollectionOwnerIdOrNull( ce ); if ( entityId != null ) { loadedOwner = getCollectionOwner( entityId, ce.getLoadedPersister() ); } return loadedOwner; }
/** * Get the ID for the entity that owned this persistent collection when it was loaded * * @param collection The persistent collection * @return the owner ID if available from the collection's loaded key; otherwise, returns null */ @Override public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection) { return getLoadedCollectionOwnerIdOrNull( getCollectionEntry( collection ) ); }
@Override public Object getLoadedCollectionOwnerIdOrNull(PersistentCollection collection) { return getLoadedCollectionOwnerIdOrNull( getCollectionEntry( collection ) ); }
/** * Get the ID for the entity that owned this persistent collection when it was loaded * * @param collection The persistent collection * @return the owner ID if available from the collection's loaded key; otherwise, returns null */ @Override public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection) { return getLoadedCollectionOwnerIdOrNull( getCollectionEntry( collection ) ); }
@Override public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection) { final CollectionEntry ce = getCollectionEntry( collection ); if ( ce.getLoadedCollectionDescriptor() == null ) { return null; } Object loadedOwner = null; // TODO: an alternative is to check if the owner has changed; if it hasn't then // return collection.getOwner() final Object entityId = getLoadedCollectionOwnerIdOrNull( ce ); if ( entityId != null ) { loadedOwner = getCollectionOwner( entityId, ce.getLoadedCollectionDescriptor() ); } return loadedOwner; }
/** * Get the entity that owned this persistent collection when it was loaded * * @param collection The persistent collection * @return the owner, if its entity ID is available from the collection's loaded key * and the owner entity is in the persistence context; otherwise, returns null */ @Override public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection) { CollectionEntry ce = getCollectionEntry( collection ); if ( ce.getLoadedPersister() == null ) { return null; // early exit... } Object loadedOwner = null; // TODO: an alternative is to check if the owner has changed; if it hasn't then // return collection.getOwner() Serializable entityId = getLoadedCollectionOwnerIdOrNull( ce ); if ( entityId != null ) { loadedOwner = getCollectionOwner( entityId, ce.getLoadedPersister() ); } return loadedOwner; }
/** * Get the entity that owned this persistent collection when it was loaded * * @param collection The persistent collection * @return the owner, if its entity ID is available from the collection's loaded key * and the owner entity is in the persistence context; otherwise, returns null */ @Override public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection) { CollectionEntry ce = getCollectionEntry( collection ); if ( ce.getLoadedPersister() == null ) { return null; // early exit... } Object loadedOwner = null; // TODO: an alternative is to check if the owner has changed; if it hasn't then // return collection.getOwner() Serializable entityId = getLoadedCollectionOwnerIdOrNull( ce ); if ( entityId != null ) { loadedOwner = getCollectionOwner( entityId, ce.getLoadedPersister() ); } return loadedOwner; }