Hi!
I can't get the following code to run:
Code:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "Customers")
@SecondaryTable(name = "Addresses")
public class Customer extends UpdatableDbEntry {
// ...
@Column(table = "Addresses", name = "STR_FIRSTNAME")
private String firstName;
}
I made some debugging and it seems like the JoinedSubClassEntityPersister just doesn't realize that there's a second table to consider; i.e. the field tableNames just contains the Customers table and also, the field propertyTableNumbers indicates that the firstName should be in that table also.
If I change the InheritanceType to SINGLE_TABLE or PER_CLASS, the persister works and recognized the secondary table (this is not applicable for obvious reasons, just to proof that I used the annotations correctly and the table exists etc.).
My main question is: is this a bug or isn't this covered by the EJB3.0 spec at all? If there would be a workaround, I'd appreciate that info also. ;)
Sebastian
Hibernate version:
3.2.0.cr1 / Annotations Beta 10
Mapping documents:
%
Code between sessionFactory.openSession() and session.close():
&
Full stack trace of any exception that occurs:
org.hibernate.AssertionFailure: Table UKASH.Addresses not found
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:444)
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:225)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:218)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1180)
Name and version of the database you are using:
%
The generated SQL (show_sql=true):
%
Debug level Hibernate log excerpt:
%