The following exception is thrown when an entity exists with a collection containing a parameterized type:
Caused by: org.hibernate.annotations.common.AssertionFailure: Fail to process type argument in a generic declaration. Member : cp.CentralizedContract#children Type: class sun.reflect.generics.reflectiveObjects.WildcardTypeImpl at org.hibernate.jpa.internal.metamodel.AttributeFactory$PluralAttributeMetadataImpl.getClassFromGenericArgument(AttributeFactory.java:890) at org.hibernate.jpa.internal.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:800) at org.hibernate.jpa.internal.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:775) at org.hibernate.jpa.internal.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:555) at org.hibernate.jpa.internal.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:93) at org.hibernate.jpa.internal.metamodel.MetadataContext.wrapUp(MetadataContext.java:227) at org.hibernate.jpa.internal.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:96) at org.hibernate.jpa.internal.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:148) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:865) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:67)
======================================= Example:
public abstract class CentralizedContract extends Contract{
@ManyToOne(cascade= {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}
, fetch=FetchType.LAZY) @JoinColumn(name="FK_PARENT", referencedColumnName="FK_CONTRACT") //it's a relationship [FK_PARENT *<=>1 FK_CONTRACT] private CentralizedContract parent;
@OneToMany(fetch = FetchType.LAZY, cascade=CascadeType.ALL, mappedBy="parent", targetEntity=CentralizedContract.class) private List<? extends CentralizedContract> children;
|