I am using DB2 to generate the Identity as in the DDL: ID BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)
And in code for the base class: @MappedSuperclass @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class Base { ..... @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private long someID; .....} Will this not use a unique ID generator per derived class? Is there a better way of doing it in DB2? Thanks for the help. Majeed Arni Abe White wrote: > > Are the two types related by inheritance? If two classes in an > inheritance hierarchy use the same id class, then every instance of > both classes must have a distinct id value. If you want instances in > inheritance-related classes to be able to have the same id values, > then you must use different id classes for different classes in the > inheritance hierarchy. > > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated > entities, that may be confidential, proprietary, copyrighted and/or > legally privileged, and is intended solely for the use of the individual > or entity named in this message. If you are not the intended recipient, > and have received this message in error, please immediately return this by > email and then delete it. > > -- View this message in context: http://www.nabble.com/Bug-when-persisting-two-related-objects-tf3719319.html#a10416417 Sent from the open-jpa-dev mailing list archive at Nabble.com.