Yes, you can do this: http://incubator.apache.org/openjpa/docs/latest/manual/manual.html#ref_g uide_pc_oid_datastore
-Patrick -- Patrick Linskey BEA Systems, Inc. _______________________________________________________________________ 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. > -----Original Message----- > From: Dain Sundstrom [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 01, 2007 10:55 AM > To: open-jpa-dev@incubator.apache.org > Subject: Unknown primary key > > Does JPA or OpenJPA have support for what is called unknown primary > key in the EJB CMP 2.0 spec. An unknown primary key is the pk of an > entity bean that does not have a field (or abstract getter/setter) > for a primary key. Instead the framework adds a virtual > field to the > bean that contains the primary key. The bean can get access to the > primary key instance calling "Object > EntityContext.getPrimaryKey()". > Typically, the unknown primary key is implemented using database > identity and a java.lang.Long. > > I can add a real field to the class via byte code transformation for > CMP1 entity beans, but would perfer not to. For CMP2, I'm already > generating a subclass so I already have a place to put the field. > > Thanks, > > -dain >