Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362601 - Error in entity name computation in case of Dynamic EMF extending Static EMF
Summary: Error in entity name computation in case of Dynamic EMF extending Static EMF
Status: RESOLVED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Teneo (show other bugs)
Version: 1.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Taal CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-01 16:57 EDT by Martin Taal CLA
Modified: 2011-11-01 17:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Taal CLA 2011-11-01 16:57:21 EDT
In the following case the EMFTuplizer will determine an incorrect entityname:

See description by user:

Today I tried to create a mapping that uses single table per hierarchy that have a concrete EMF class as a base and then all subclasses are dynamic EMF classes.

I found out that the hibernate treated all instances as of they were from the base class and not from the subclasses - e.g. all properties that are set in the subclasses are not persisted and the discriminator value that is used is from the base (root) class. Digging more into this issue I found out that the following method on EMFTuplizer class

public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
final Class<?> concreteEntityClass = entityInstance.getClass();
if (concreteEntityClass == getMappedClass()) {
return getEntityName();
} else {
String entityName = getEntityMetamodel().findEntityNameByEntityClass(concreteEntityClass);
if (entityName == null) {
throw new HibernateException("Unable to resolve entity name from Class ["
+ concreteEntityClass.getName() + "]" + " expected instance/subclass of [" + getEntityName()
+ "]");
}
return entityName;
}
}


returns always the entity name for the root EMF class because the getMappedClass() is always equal to the concreteEntityClass ( note that when I create a objects from subclasses the actual base class will be the implementation class of the root EMF class (the one that is generated - not dynamic))
Comment 1 Martin Taal CLA 2011-11-01 17:39:11 EDT
Fixed in build of 1 Nov 2011