Given is a jpa entity with a field or property of type java.util.Collection (List, Map, etc) that is only annotated with an @org.hibernate.annotations.Type. This entity seems to be validly configured, as the persistence context will load up. However, when hibernate-jpamodelgen is used and a static metamodel class of that entity exists and its attributes get populated, you will see an ERROR log entry like this:
MetadataContext:454 - HHH015007: Illegal argument on static metamodel field injection : org.hibernate.bugs.entities.TestEntity_#userTypeList; expected type : org.hibernate.jpa.internal.metamodel.SingularAttributeImpl; encountered type : javax.persistence.metamodel.ListAttribute
The targeted metamodel field is obviously null afterwards. An old, resolved bug hints to me, that the usage of @Type in a jpa context is in general supported: http://lists.jboss.org/pipermail/hibernate-issues/2010-October/025798.html Please see my forked hibernate test case project on github: https://github.com/LorenzSchumann/hibernate-test-case-templates |