// Initialize the class with the package from entity mappings.
Class entityClass = getClassForName(entity.getClassName());
// Initialize the entity with its metadata descriptor and
// project.
entity.initXMLClassAccessor(new MetadataClass(entityClass, this), new MetadataDescriptor(entityClass, entity), m_project);
if (allEntities.containsKey(entityClass.getName())) {
// Merge this entity with the existing one.
allEntities.get(entityClass.getName()).merge(entity);
} else {
// Add this entity to the map.
allEntities.put(entityClass.getName(), entity);
}
}
// Process the embeddables.
for (EmbeddableAccessor embeddable : getEmbeddables()) {
// Initialize the class with the package from entity mappings.
Class embeddableClass = getClassForName(embeddable.getClassName());
// Initialize the embeddable with its metadata descriptor and
// project.
embeddable.initXMLClassAccessor(new MetadataClass(embeddableClass, this), new MetadataDescriptor(embeddableClass, embeddable), m_project);
if (allEmbeddables.containsKey(embeddableClass.getName())) {
// Merge this embeddable with the existing one.
allEmbeddables.get(embeddableClass.getName()).merge(embeddable);
} else {
// Add this embeddable to the map.
allEmbeddables.put(embeddableClass.getName(), embeddable);
}
}
// Process the mapped superclasses
for (MappedSuperclassAccessor mappedSuperclass : getMappedSuperclasses()) {
// Initialize the class with the package from entity mappings.
Class mappedSuperclassClass = getClassForName(mappedSuperclass.getClassName());
// Just set the accessible object on the mapped superclass for now.
// Mapped superclasses are reloaded for each entity that inherits
// from it. After each reload, the initXMLObjects is called and
// ready to be processed there after.
mappedSuperclass.setAccessibleObject(new MetadataClass(mappedSuperclassClass, this));
// Add it to the project. This will merge it if necessary.
m_project.addMappedSuperclass(mappedSuperclassClass.getName(), mappedSuperclass);
}
}