users@glassfish.java.net

Getting an Entity instance from the current persistence context

From: <glassfish_at_javadesktop.org>
Date: Fri, 25 May 2007 11:57:14 PDT

I ran a little test:

* multiple session bean methods each make an update to different parts of the same Entity Class, and are also given the same primary key to do a find() on, so they are all updating the same row

* The first bean does its find(), updates some fields, then the function ends. The next bean (in the same transaction context) then does a find() on the same class and ID, but it does not get the updated entity that is currently in the persistence context

I thought the second find would not go to the database, because an entity instance with that ID is already in the persistence context. If that does not work, how do I get the currently managed entity instance in the second bean so I can make further updates to it?


Thanks!

Andrew
[Message sent by forum member 'asmithgf' (asmithgf)]

http://forums.java.net/jive/thread.jspa?messageID=218991