This gets weirder and weirder (from my perspective). There seems to be some kind of a time delay between when the merge() happens and when the cache is updated in such a way that the find() call brings back the correct, changed object.
Let me see if I can describe this in terms of the user interaction.
I have a row in a table that is backed by the primary key of the object it stands in for. If you double click the row, I do a call to my stateless-session-bean-that-fronts-the-entity-manager-find()-call. So, double click on a row and you do a find().
I load the object in a window. There you can make changes. When you hit the "Save and Close" button, I call the stateless-session-bean-that-fronts-the-entity-manager-merge()-call. The frame and its bean are destroyed. So hit save-and-close and you do a merge().
Now, if you double click the same table row [i]within the next [/i]two[i] seconds or so[/i], the [i]stale[/i] bean comes back. That is, the window opens up with all the stuff BEFORE you made your changes and saved and closed.
If, instead, you go through this sequence, but this time you wait about [i]three[/i] seconds or so after the save-and-close operation, then double clicking on the row brings back the [i]correct[/i] object!
Is the cache updated asynchronously? If so, how often?
Now off to check the transactionality of my SLSB as suggested.
Thanks,
Laird
[Message sent by forum member 'ljnelson' (ljnelson)]
http://forums.java.net/jive/thread.jspa?messageID=228417