public void doSecondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas) throws MappingException { if (log.isDebugEnabled()) log.debug("Second pass for collection: " + collection.getRole()); secondPass(persistentClasses, inheritedMetas); collection.createAllKeys(); if (log.isDebugEnabled()) { String msg = "Mapped collection key: " + columns(collection.getKey()); if (collection.isIndexed()) msg += ", index: " + columns(((IndexedCollection) collection).getIndex()); if (collection.isOneToMany()) { msg += ", one-to-many: " + ((OneToMany) collection.getElement()).getReferencedEntityName(); } else { msg += ", element: " + columns(collection.getElement()); } log.debug(msg); } }
public void doSecondPass(java.util.Map persistentClasses) throws MappingException { if (log.isDebugEnabled()) log.debug("Second pass for collection: " + collection.getRole()); secondPass( persistentClasses, localInheritedMetas); // using local since the inheritedMetas at this point is not the // correct map since it is always the empty map collection.createAllKeys(); if (log.isDebugEnabled()) { String msg = "Mapped collection key: " + columns(collection.getKey()); if (collection.isIndexed()) msg += ", index: " + columns(((IndexedCollection) collection).getIndex()); if (collection.isOneToMany()) { msg += ", one-to-many: " + ((OneToMany) collection.getElement()).getReferencedEntityName(); } else { msg += ", element: " + columns(collection.getElement()); } log.debug(msg); } }
public static void bindCollectionSecondPass( Collection collection, java.util.Map persistentClasses, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { if (collection.isOneToMany()) { OneToMany oneToMany = (OneToMany) collection.getElement(); PersistentClass persistentClass = mappings.getClass(oneToMany.getReferencedEntityName()); if (persistentClass == null) throw new MappingException( "Association " + collection.getRole() + " references unmapped class: " + oneToMany.getReferencedEntityName()); oneToMany.setAssociatedClass(persistentClass); // Child } }
@Override public Class<? extends CollectionPersister> getCollectionPersisterClass(Collection metadata) { return metadata.isOneToMany() ? oneToManyPersister() : basicCollectionPersister(); }