Hi Dain,

How about

Object pk = bean.getId();


On Dec 11, 2006, at 11:00 AM, Dain Sundstrom wrote:

Is there a way to extract the primary key from a persistent bean using a spec JPA API or an API specific to OpenJPA? I'm thinking of something like this:

    MyBean bean = new MyBean();
    Object pk = entityManager.getPrimaryKey(bean);
    MyBean foundBean = entityManager.find(MyBean.class, pk);
    assertEquals(bean, foundBean);


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to