openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <>
Subject Re: Get primary key from persistent bean
Date Tue, 12 Dec 2006 01:54:35 GMT

Note that you could always introspect on the class and look for the  
@Id annotation, and get the value of the Field/Method on which the  
annotation resides. This is pretty heavy-handed, and doesn't work for  
XML mappings, but it is one possible way to do this without making  
assumptions about the underlying vendor.

On Dec 11, 2006, at 5:45 PM, Dain Sundstrom wrote:

> On Dec 11, 2006, at 5:34 PM, Craig L Russell wrote:
>> Hi Dain,
>> How about
>> Object pk = bean.getId();
> That implies that every persistent bean implements getId().  That  
> would work find for the beans I write but not for beans other  
> write.  This is a major hole in the JPA spec if you ask me.
> -dain

View raw message