[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4036?page=c...
]
Ed Bras commented on HHH-4036:
------------------------------
And here is the patch.... On the source (3.3.2.GA):
I tested it, and works now for me, as it supposed to be...
---------------
Index: src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
===================================================================
--- src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java (revision 17619)
+++ src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java (working copy)
@@ -33,24 +33,22 @@
import java.util.Map;
import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
-import org.hibernate.tuple.IdentifierProperty;
-import org.hibernate.tuple.StandardProperty;
-import org.hibernate.tuple.PropertyFactory;
-import org.hibernate.tuple.VersionProperty;
-import org.hibernate.intercept.FieldInterceptionHelper;
import org.hibernate.engine.CascadeStyle;
import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.engine.Versioning;
import org.hibernate.engine.ValueInclusion;
+import org.hibernate.engine.Versioning;
+import org.hibernate.intercept.FieldInterceptionHelper;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.PropertyGeneration;
+import org.hibernate.tuple.IdentifierProperty;
+import org.hibernate.tuple.PropertyFactory;
+import org.hibernate.tuple.StandardProperty;
+import org.hibernate.tuple.VersionProperty;
import org.hibernate.type.AbstractComponentType;
import org.hibernate.type.AssociationType;
import org.hibernate.type.EntityType;
@@ -58,6 +56,8 @@
import org.hibernate.type.TypeFactory;
import org.hibernate.util.ArrayHelper;
import org.hibernate.util.ReflectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Centralizes metamodel information about an entity.
@@ -576,7 +576,7 @@
* @return The mapped entity-name, or null if no such mapping was found.
*/
public String findEntityNameByEntityClass(Class inheritenceClass) {
- return ( String ) entityNameByInheritenceClassNameMap.get( inheritenceClass.getName()
);
+ return ( String ) entityNameByInheritenceClassNameMap.get( inheritenceClass);
}
public String toString() {
EntityMetamodel entityNameByInheritenceClassNameMap field used
inconsistently
-----------------------------------------------------------------------------
Key: HHH-4036
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4036
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Reporter: Jeremy Stone
After upgrading (from 3.3.0.SP1) to 3.3.2.GA we have started getting the follow stack
trace logged:
org.hibernate.HibernateException: Unable to resolve entity name from Class
[com.cyclone.netPrefect.admin.restriction.complex.TimeSpanRestrictionItemEntity] expected
instance/subclass of [RestrictionItem]
at
org.hibernate.tuple.entity.PojoEntityTuplizer.determineConcreteSubclassEntityName(PojoEntityTuplizer.java:363)
at
org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3643)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1375)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
at
org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:535)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103)
... etc, etc
The com.cyclone.netPrefect.admin.restriction.complex.TimeSpanRestrictionItemEntity is
mapped (with entity name TimeSpanRestrictionItem) as a joined subclass of the entity named
RestrictionItem.
I have had a look at the Hibernate source for 3.3.2.ga and it looks like problem is the
way that the org.hibernate.tuple.entity.EntityMetamodel is using it
entityNameByInheritenceClassNameMap field:
* Puts to the map are based on PersistentClass.getMappedClass() as a key - a Class
object
* Gets from the map (in findEntityNameByEntityClass method) are using the class
name
Presumably (given the name of the map field) both put and get should be using the class
name.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira