HHH-6285 Adding test case

This commit is contained in:
Hardy Ferentschik 2012-08-02 16:46:43 +02:00
parent 28c52727b4
commit 18a255a0e0
1 changed files with 33 additions and 1 deletions

View File

@ -25,6 +25,8 @@ package org.hibernate.metamodel.internal.source.annotations.entity;
import javax.persistence.Access; import javax.persistence.Access;
import javax.persistence.AccessType; import javax.persistence.AccessType;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
@ -69,7 +71,11 @@ public class AccessBindingTest extends BaseAnnotationBindingTestCase {
@Resources(annotatedClasses = { PropertyAccess.class }) @Resources(annotatedClasses = { PropertyAccess.class })
public void testDefaultPropertyAccess() { public void testDefaultPropertyAccess() {
EntityBinding binding = getEntityBinding( PropertyAccess.class ); EntityBinding binding = getEntityBinding( PropertyAccess.class );
assertEquals( "Wrong access type", "property", binding.locateAttributeBinding( "id" ).getPropertyAccessorName() ); assertEquals(
"Wrong access type",
"property",
binding.locateAttributeBinding( "id" ).getPropertyAccessorName()
);
} }
@Entity @Entity
@ -159,6 +165,32 @@ public class AccessBindingTest extends BaseAnnotationBindingTestCase {
); );
} }
@Entity
class EntityWithEmbeddedId {
EmbeddableId id;
@EmbeddedId
public EmbeddableId getId() {
return id;
}
}
@Embeddable
public class EmbeddableId {
String ssn;
}
@Test
@Resources(annotatedClasses = { EntityWithEmbeddedId.class, EmbeddableId.class })
public void testEmbeddedIdWithPropertyAccess() {
EntityBinding binding = getEntityBinding( EntityWithEmbeddedId.class );
assertEquals(
"Wrong access type",
"property",
binding.locateAttributeBinding( "id" ).getPropertyAccessorName()
);
}
} }