users@glassfish.java.net

Re: JPA optimistic locking inconsistency

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Oct 2007 09:19:20 PDT

It depends what you mean by relationship fields. The class looks like this:

class Issue {

@JoinColumn(name = "status", referencedColumnName = "status", nullable = false)
@ManyToOne
private Status status;
...
@Version
@Column(name = "ts", nullable = false)
private Timestamp optimisticLockField;
}

The table ISSUE in the database has a field status, which is a foreign key to the table STATUS, which contains all legal status values.

So in my eyes any change to the ISSUE table's status field must be detected, because it is a change occuring in the exact table that is protected by optimistic locking. It should not matter whether there is a relationship or not.

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

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