-
1. 3858086
bill.burke Dec 13, 2004 9:35 AM (in response to pmoermans)I don't think this is possible. If you have inheritance, i believe the primary key class/field needs to be the same for all subclasses. I'll double check with the EG.
Bill -
2. Re: composite PK and joined-inheritance
pmoermans Dec 13, 2004 4:54 PM (in response to pmoermans)It works when using TABLE_PER_CLASS or SINGLE_TABLE strategies.
In my case, this is ennoying because A should be abstract. Therefore I don't need to have a table in the database for that class.
Is is possible to declare the inheritance in Hibernate and specify not to create a table for class A ?
Many thanks,
Pierre -
3. Re: composite PK and joined-inheritance
bill.burke Dec 13, 2004 5:10 PM (in response to pmoermans)Don't mark the abstract class as an @Entity.
-
4. Re: composite PK and joined-inheritance
bill.burke Dec 13, 2004 5:23 PM (in response to pmoermans)ONE MORE THING....
Keep these kind of use cases coming...I'm am forwarding your input to the EG as its good stuff.
Bill -
5. Re: composite PK and joined-inheritance
pmoermans Dec 14, 2004 5:29 AM (in response to pmoermans)Not marking the abstract class as @Entity only works if there is no relationship with other classes.
One of the reason I wanted to use an abstract class is that their should be a ManyToOne relationship with this class.
When I don't specify it as @Entity, I get a "normal" MappingError.
What I'd like to do is:
A is an abstract class, with no table in the DB
B and C inherits from A
D has many instances of A.
Pierre -
6. 3765226
bill.burke Dec 14, 2004 8:46 AM (in response to pmoermans)Checked with EG. I was correct. You are not allowed to do this as per the spec. In an inheritance mapping, all primary keys must be the same types and defined int he base class.