diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerMessageLogger.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerMessageLogger.java index 56c56d5b6c..ad7811a15c 100644 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerMessageLogger.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerMessageLogger.java @@ -80,8 +80,8 @@ public interface EntityManagerMessageLogger extends CoreMessageLogger { URL jarUrl, @Cause Exception e); - @LogMessage(level = ERROR) - @Message(value = "Unable to locate static metamodel field : %s#%s", id = 15011) + @LogMessage(level = WARN) + @Message(value = "Unable to locate static metamodel field : %s#%s; this may or may not indicate a problem with the static metamodel", id = 15011) void unableToLocateStaticMetamodelField( String name, String name2); diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/MetadataContext.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/MetadataContext.java index a16e999934..303825169f 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/MetadataContext.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/MetadataContext.java @@ -19,6 +19,7 @@ import javax.persistence.metamodel.Attribute; import javax.persistence.metamodel.IdentifiableType; import javax.persistence.metamodel.MappedSuperclassType; import javax.persistence.metamodel.SingularAttribute; +import javax.persistence.metamodel.Type; import org.hibernate.annotations.common.AssertionFailure; import org.hibernate.engine.spi.SessionFactoryImplementor; @@ -411,7 +412,11 @@ class MetadataContext { // // As a result, in the case of embeddable classes we simply use getField rather than get // getDeclaredField - final Field field = attribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.EMBEDDED + final boolean allowNonDeclaredFieldReference = + attribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.EMBEDDED + || attribute.getDeclaringType().getPersistenceType() == Type.PersistenceType.EMBEDDABLE; + + final Field field = allowNonDeclaredFieldReference ? metamodelClass.getField( name ) : metamodelClass.getDeclaredField( name ); try { diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderComponentId_.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderComponentId_.java deleted file mode 100644 index 9a5e77ace1..0000000000 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderComponentId_.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.jpa.test.metamodel.attributeInSuper; - -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -@StaticMetamodel(WorkOrderComponentId.class) -public abstract class WorkOrderComponentId_ extends WorkOrderId_ { - - public static volatile SingularAttribute lineNumber; - -} \ No newline at end of file diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderComponent_.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderComponent_.java deleted file mode 100644 index 8886435300..0000000000 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderComponent_.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.jpa.test.metamodel.attributeInSuper; - -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -/** - * @author Steve Ebersole - */ -@StaticMetamodel(WorkOrderComponent.class) -public class WorkOrderComponent_ { - public static volatile SingularAttribute id; - public static volatile SingularAttribute workOrder; - -} diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderId_.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderId_.java deleted file mode 100644 index bdeaf2451f..0000000000 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrderId_.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.jpa.test.metamodel.attributeInSuper; - -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -@StaticMetamodel(WorkOrderId.class) -public abstract class WorkOrderId_ { - public static volatile SingularAttribute plantId; - public static volatile SingularAttribute workOrder; -} diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrder_.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrder_.java deleted file mode 100644 index 8bdd84bbd0..0000000000 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/metamodel/attributeInSuper/WorkOrder_.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.jpa.test.metamodel.attributeInSuper; - -import java.util.Set; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -@StaticMetamodel(WorkOrder.class) -public class WorkOrder_ { - public static volatile SingularAttribute id; - public static volatile PluralAttribute components; - -}