users@glassfish.java.net

JPA optimistic locking inconsistency

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Oct 2007 08:42:31 PDT

Hello,

I have two different classes with a @Version annotation on a java.sql.Timestamp field. My expectation was that external modifications to either table would be picked up by the EntityManager, because the timestamp-field is updated automatically by a database trigger. First of all, is this expectation correct?

Assuming yes, here is what I observe: external modifications done in this way are only picked up by the first class, the other one gets stale data. The only difference between both classes is that the one that is not working right has a number of ManyToOne declarations, whereas the working class has no relationships. I did try to set CascadeType.REFRESH for the relations, but there was no effect.

Any ideas what could be the reason for the inconsistent behavior? Glassfish b58c.

Kind regards,

Ulrich
[Message sent by forum member 'ulim' (ulim)]

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