From 18a255a0e0027d6761f4575ef06cc74f03f9f9a3 Mon Sep 17 00:00:00 2001 From: Hardy Ferentschik Date: Thu, 2 Aug 2012 16:46:43 +0200 Subject: [PATCH] HHH-6285 Adding test case --- .../annotations/entity/AccessBindingTest.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/AccessBindingTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/AccessBindingTest.java index 4cd127ba2f..29d520e204 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/AccessBindingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/AccessBindingTest.java @@ -25,6 +25,8 @@ package org.hibernate.metamodel.internal.source.annotations.entity; import javax.persistence.Access; import javax.persistence.AccessType; +import javax.persistence.Embeddable; +import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.Id; @@ -69,7 +71,11 @@ public class AccessBindingTest extends BaseAnnotationBindingTestCase { @Resources(annotatedClasses = { PropertyAccess.class }) public void testDefaultPropertyAccess() { EntityBinding binding = getEntityBinding( PropertyAccess.class ); - assertEquals( "Wrong access type", "property", binding.locateAttributeBinding( "id" ).getPropertyAccessorName() ); + assertEquals( + "Wrong access type", + "property", + binding.locateAttributeBinding( "id" ).getPropertyAccessorName() + ); } @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() + ); + } }