Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TABLE_PER_CLASS inheritance and different sequences for id generation

user9970455Mar 31 2009 — edited Apr 1 2009
I'd like to use the new table_per_class inheritance strategy for my parent and child class. Their @Id is a GeneratedValue(strategy=GenerationType.SEQUENCE). As they are mapped to different tables, they should each use a different sequence to generate the values for the @Id column.


@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public class Mama {
@Id
@SequenceGenerator(name="MAMA_SEQ", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="MAMA_SEQ")
@Column(name="IDENT_LOCAL")
protected long ident;
.....
}

public class Child extends Mama{
@Id
@SequenceGenerator(name="CHILD_SEQ", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="CHILD_SEQ")
@Column(name="IDENT_LOCAL")
protected long ident;
....
}



Is it possible to use a different oracle sequence for id generation within the child?

Best Regards
Daniela Weil
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2009
Added on Mar 31 2009
2 comments
4,135 views