Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Initialize the role of the collection.
- *
- * The CollectionEntry.reached stuff is just to detect any silly users who set up
- * circular or shared references between/to collections.
- */
- void updateReachableCollection(PersistentCollection coll, Type type, Object owner) throws HibernateException {
- CollectionEntry ce = getCollectionEntry(coll);
- if (ce==null) {
- // refer to comment in addCollection()
- 0x throw new HibernateException("Found two representations of same collection: " + coll.getCollectionSnapshot().getRole());
- }
- if (ce.reached) {
- // We've been here before
- 0x throw new HibernateException("Found shared references to a collection: " + coll.getCollectionSnapshot().getRole());
- }
- ce.reached = true;
- CollectionPersister persister = getCollectionPersister( ( (PersistentCollectionType) type ).getRole() );
- ce.currentPersister = persister;
- ce.currentKey = getEntityIdentifier(owner); //TODO: better to pass the id in as an argument?
- if ( log.isDebugEnabled() ) {
- log.debug(
- "Collection found: " + MessageHelper.infoString(persister, ce.currentKey) +
- ", was: " + MessageHelper.infoString(ce.loadedPersister, ce.loadedKey)
- );
- }
- prepareCollectionForUpdate(coll, ce);
- }
Add Comment
Please, Sign In to add comment