Hibernate version:
3.1 beta 1
Hibernate annotations version:
3.1 beta 4
Name and version of the database you are using:
MySQL 4.1.13
I have an abstract class
User which is extended by the three classes
Student,
Lecturer and
Administrator using the strategy
single table per class hierarchy.
When trying to get it started, I get the exception below. I could not figure out what I went wrong. Maybe it's just too late... 8)
I hope you can help me. Thanks in advance!
User:
@Entity()
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Table(name = "users")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE, discriminatorType = DiscriminatorType.STRING)
@DiscriminatorColumn(name = "discriminator")
public abstract class User implements Comparable {
...
}
Student:
@Entity()
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Inheritance(discriminatorValue = "student")
public class Student extends User {
...
}
Lecturer:
@Entity()
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Inheritance(discriminatorValue = "lecturer")
public class Lecturer extends User {
...
}
Administrator:
@Entity()
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Inheritance(discriminatorValue = "administrator")
public class Administrator extends User {
...
}
Full stack trace of any exception that occurs:
Code:
Exception in thread "main" java.lang.ExceptionInInitializerError
at de.w3s.tools.HibernateUtil.<clinit>(HibernateUtil.java:38)
at de.w3s.tools.DDLManager.main(DDLManager.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Caused by: org.hibernate.AnnotationException: Unable to find entity de.w3s.persistence.Lecturer
at org.hibernate.cfg.AnnotationBinder.bindFkSecondPass(AnnotationBinder.java:1480)
at org.hibernate.cfg.FkSecondPass.secondPass(FkSecondPass.java:37)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:31)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1026)
at de.w3s.tools.HibernateUtil.<clinit>(HibernateUtil.java:34)