-
1. Re: Troubles with table-per-class inheritance
bill.burke Mar 30, 2005 10:45 AM (in response to mauburn)I'll try to reproduce and fix. I don't like regressing between releases.
Pretty cool/interesting use case though. So interesting in fact, i've forwarded it to the EG for contemplation.... -
2. Re: Troubles with table-per-class inheritance
mauburn Mar 30, 2005 12:48 PM (in response to mauburn)To give a little more detail: in preview 4, I defined the Group3 class as follows:
@Entity(access = AccessType.FIELD)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "Groups")
public class Group3 extends BaseEntity3<GroupPK3>
...
Once I moved to the CVS source code version, I had to remove the @Inheritance tag from Group3 because otherwise I got a Hibernate error on deployment:
2005-03-29 10:31:22,950 ERROR [org.hibernate.cfg.AnnotationConfiguration] Could not compile the mapping annotations
org.hibernate.AnnotationException: TABLE_PER_CLASS only allows hierarchy leaf mapping
The Hibernate error seems rather counterintuitive, given that getting rid of the error requires removing the @INHERITANCE annotation from the leaf class!
I believe that this class structure is pretty generic and useful - probably as more people get used to using Java 5 generics (we just transitioned recently ourselves), more people will want to do things like this...
- Mark -
3. Re: Troubles with table-per-class inheritance
piero Apr 12, 2005 7:00 AM (in response to mauburn)seems to be a similar problem i ran into - worked fine until i used the cvs version:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class DBObject implements java.io.Serializable {
private long id;
private Date lastChanged;
private Date created;
i used this base class to define fields which must be present in every class/table:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Customer extends DBObject {
with the jboss-head from cvs it doesn't work. the error is:
TABLE_PER_CLASS only allows hierarchy leaf mapping
is there any way to get around this for now?