I have code *similar* to the following
Code:
public interface TheInterface
{
}
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class AbstractClass
{
@Id
public int id;
abstract void foo();
}
@Entity
public class DerivedClass1 extends AbstractClass implements TheInterface
{
void foo() {}
}
@Entity
public class DerivedClass2 extends AbstractClass
{
void foo() {}
}
public class Main
{
public static void main(String args[])
{
Session session = HibernateUtil.getSession();
DerivedClass1 dc1 = new DerivedClass1();
session.save(dc1);
List<AbstractClass> list = session.createQuery("from AbstractClass").list();
if(!(list.get(0) instanceof TheInterface))
throw RuntimeException("What the hell is going on here?");
}
}
Now, the weird thing is that I'm gettting the RuntimeException!
Debuging into it shows me that the runtime type of list.get(0) is a cglib enhanced version of AbstractClass, which should be impossible, since it's abstract!
Hibernate version: 3.1, with annotations 3.1beta9
Mapping documents:Annotations, no mapping
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Name and version of the database you are using:MySQL, version 5
The generated SQL (show_sql=true):N/A?
Debug level Hibernate log excerpt:N/A?
[/code]