openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <>
Subject RE: Unknown primary key
Date Thu, 01 Feb 2007 19:42:01 GMT
Yes, you can do this:


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 [] 
> Sent: Thursday, February 01, 2007 10:55 AM
> To:
> 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

View raw message