Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate Inheritance.TABLE_PER_CLASS strategy
    primarykey
    data
    text
    <p>I am having a very huge problem with hibernate.</p> <p>My inheritance strategy works perfectly under eclipselink as the jpa provider, both under glassfish and jboss application servers, but when i switch to hibernate, everything goes heywire.</p> <p>I have read several posts here but none solves my problem.</p> <p>The following is the stacktrace.</p> <pre><code>Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21] Caused by: java.lang.ClassCastException: org.hibernate.mapping.UnionSubclass cannot be cast to org.hibernate.mapping.RootClass at org.hibernate.cfg.annotations.PropertyBinder.bind(PropertyBinder.java:210) at org.hibernate.cfg.annotations.PropertyBinder.makePropertyValueAndBind(PropertyBinder.java:201) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2011) at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:765) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:684) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3406) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3360) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1334) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724) at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:84) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] ... 3 more </code></pre> <p>I have made sure that no subclass defines another @Id column (In any case, netbeans will always flag for me this error)</p> <p>These is one set of inheritance i have:</p> <pre><code>@Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @PartialSecurity public abstract class DataVerification extends SecureEntity implements Serializable { private static final long serialVersionUID = IdGenerator.serialVersionUID(DataVerification.class); @Id private Long verificationId = IdGenerator.generateId(); @Column(length = 50, nullable = false) private String verificationCode; private String verifiedId; private boolean verified; @Temporal(javax.persistence.TemporalType.TIMESTAMP) private Calendar verificationDate; private DataVerificationType dataVerificationType; private VerificationMethod verificationMethod; @OneToOne private Account verifiedBy; @OneToOne private Account approvedBy; /** * * @author marembo */ @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class OnlineDataVerification extends DataVerification implements Serializable { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @Ignore private List&lt;UploadFile&gt; verificationFiles; /** * * @author marembo */ @Entity public class IncomeDataVerification extends OnlineDataVerification implements Serializable { private static final long serialVersionUID = IdGenerator.serialVersionUID(IncomeDataVerification.class); private IncomeSource incomeSource; private String occupation; /** * * @author marembo */ @Entity public class AgentDataVerification extends OnlineDataVerification implements Serializable { @Column(length = 2048, nullable = false) private String comment; private String verificationTransaction = IdGenerator.generateStringId(); </code></pre> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload