I don't think it matters whether you are using DB2 or any other database. Getting back to one of Patrick's earlier requests... Can you post more information on the Project and Base classes? You've posted a snippet of the Base class and it's ID, but how are you defining the Project and it's ID? As Abe as pointed out, if two classes in an inheritance hierarchy use the same ID class, then unique id values need to be provided for each instance. Could you also post your DDL for generating your tables? Was this hand-generated DDL or created by the OpenJPA tooling? Thanks.
Kevin On 5/10/07, Majeed Arni <[EMAIL PROTECTED]> wrote:
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.