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; } }
private Object getIndexInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent ){ Object collection = persister.getPropertyValue( potentialParent, property, session.getEntityMode() ); if ( collection!=null && Hibernate.isInitialized(collection) ) { return collectionPersister.getCollectionType().indexOf(collection, childEntity); } else { return null; } }
private Object getIndexInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent){ Object collection = persister.getPropertyValue( potentialParent, property ); if ( collection!=null && Hibernate.isInitialized(collection) ) { return collectionPersister.getCollectionType().indexOf(collection, childEntity); } else { return null; } }
private Object getIndexInParent( String property, Object childEntity, EntityPersister persister, CollectionPersister collectionPersister, Object potentialParent){ Object collection = persister.getPropertyValue( potentialParent, property ); if ( collection!=null && Hibernate.isInitialized(collection) ) { return collectionPersister.getCollectionType().indexOf(collection, childEntity); } else { return null; } }
/** * Search the persistence context for an index of the child object, * given a collection role */ public Object getIndexInOwner(String role, Object childObject) { int loc = role.lastIndexOf('.'); String entity = role.substring(0, loc); String property = role.substring( loc+1, role.length() ); EntityPersister persister = session.getFactory().getEntityPersister(entity); CollectionPersister cp = session.getFactory().getCollectionPersister(role); Iterator entities = entityEntries.entrySet().iterator(); while ( entities.hasNext() ) { Map.Entry me = (Map.Entry) entities.next(); EntityEntry ee = (EntityEntry) me.getValue(); if ( persister.isSubclassEntityName( ee.getEntityName() ) ) { Object collection = persister.getPropertyValue( me.getKey(), property, session.getEntityMode() ); if ( collection!=null ) { if ( Hibernate.isInitialized(collection) ) { Object index = cp.getCollectionType().indexOf(collection, childObject); if (index!=null) return index; } } } } return null; }