openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@iq80.com>
Subject Get primary key from persistent bean
Date Mon, 11 Dec 2006 19:00:46 GMT
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();
     entityManager.persist(bean);
     Object pk = entityManager.getPrimaryKey(bean);
     MyBean foundBean = entityManager.find(MyBean.class, pk);
     assertEquals(bean, foundBean);

-dain

Mime
View raw message