diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java index 3abe1e6bf2..b39a6b7242 100644 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java @@ -33,20 +33,20 @@ import javax.persistence.metamodel.EntityType; public class EntityTypeImpl extends AbstractIdentifiableType implements EntityType, Serializable { - private final String className; + private final String nodeName; public EntityTypeImpl( Class javaType, AbstractIdentifiableType superType, - String className, + String nodeName, boolean hasIdentifierProperty, boolean isVersioned) { super( javaType, superType, hasIdentifierProperty, isVersioned ); - this.className = className; + this.nodeName = nodeName; } public String getName() { - return className; + return nodeName; } public BindableType getBindableType() { diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java index 6d4cb5761f..5f0c9fa70f 100644 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java @@ -94,7 +94,7 @@ public class MetamodelImpl implements Metamodel, Serializable { EntityTypeImpl entityType = new EntityTypeImpl( javaType, superType, - persistentClass.getClassName(), + persistentClass.getNodeName(), persistentClass.hasIdentifierProperty(), persistentClass.isVersioned() ); @@ -102,7 +102,7 @@ public class MetamodelImpl implements Metamodel, Serializable { context.popEntityWorkedOn(persistentClass); return entityType; } - + private static MappedSuperclassTypeImpl locateOrBuildMappedsuperclassType( MappedSuperclass mappedSuperclass, MetadataContext context) { MappedSuperclassTypeImpl mappedSuperclassType = context.locateMappedSuperclassType( mappedSuperclass ); diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/House.java b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/House.java index 401233da87..f80f6a677c 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/House.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/House.java @@ -37,7 +37,7 @@ import javax.persistence.OrderColumn; /** * @author Emmanuel Bernard */ -@Entity +@Entity(name="org.hibernate.ejb.test.metadata.House") public class House { private Key key; private Address address; diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/MetadataTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/MetadataTest.java index 13d7b36412..bb2cf6443e 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/MetadataTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/MetadataTest.java @@ -97,7 +97,7 @@ public class MetadataTest extends TestCase { final SingularAttribute id2 = fridgeType.getId( Long.class ); assertNotNull( id2 ); - assertEquals( Fridge.class.getName(), fridgeType.getName() ); + assertEquals( "Fridge", fridgeType.getName() ); assertEquals( Long.class, fridgeType.getIdType().getJavaType() ); assertTrue( fridgeType.hasSingleIdAttribute() ); assertFalse( fridgeType.hasVersionAttribute() ); @@ -106,6 +106,7 @@ public class MetadataTest extends TestCase { assertEquals( 3, fridgeType.getDeclaredAttributes().size() ); final EntityType houseType = factory.getMetamodel().entity( House.class ); + assertEquals( "org.hibernate.ejb.test.metadata.House", houseType.getName() ); assertTrue( houseType.hasSingleIdAttribute() ); final SingularAttribute houseId = houseType.getDeclaredId( House.Key.class ); assertNotNull( houseId ); @@ -113,6 +114,7 @@ public class MetadataTest extends TestCase { assertEquals( Attribute.PersistentAttributeType.EMBEDDED, houseId.getPersistentAttributeType() ); final EntityType personType = factory.getMetamodel().entity( Person.class ); + assertEquals( "Homo", personType.getName() ); assertFalse( personType.hasSingleIdAttribute() ); final Set> ids = personType.getIdClassAttributes(); assertNotNull( ids ); diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/Person.java b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/Person.java index 7d0133566e..4ee04acfb1 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/Person.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/ejb/test/metadata/Person.java @@ -32,7 +32,7 @@ import javax.persistence.Entity; * @author Emmanuel Bernard */ @IdClass(Person.PersonPK.class) -@Entity +@Entity(name="Homo") //Person in latin ;) public class Person { private String firstName; private String lastName;