Hibernate ORM AssociationKey - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM AssociationKey class.

This code example shows how to use the following methods:
	 * Search the persistence context for an index of the child object, 
	 * given a collection role 
	 */ 
	public Object getIndexInOwner(String entity, String property, Object childEntity, Map mergeMap) { 
 
		EntityPersister persister = session.getFactory() 
				.getEntityPersister(entity); 
		CollectionPersister cp = session.getFactory() 
				.getCollectionPersister(entity + '.' + property); 
 
	    // try cache lookup first 
	    Object parent = parentsByChild.get(childEntity); 
		if (parent != null) { 
			final EntityEntry entityEntry = (EntityEntry) entityEntries.get(parent); 
			//there maybe more than one parent, filter by type 
			if ( persister.isSubclassEntityName( entityEntry.getEntityName() ) ) { 
				Object index = getIndexInParent(property, childEntity, persister, cp, parent); 
 
				if (index==null && mergeMap!=null) { 
					Object unmergedInstance = mergeMap.get(parent); 
Full Snippet Info
1
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java