openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Grassel <>
Subject Re: @Version
Date Mon, 28 Sep 2009 15:52:30 GMT

Good morning!

Couple questions.  When you fetch the entity with the getById() call, are
   1) Modifying any of its persistent fields?
   2) Establishing a write-lock? (by API action or configured default

If you're just fetching data, without mutating it and without any
write-locks, then there is some sort of problem which would need to be

As for the Exception, 
org.apache.openjpa.persistence.OptimisticLockException, being thrown, the
javadoc at
states that org.apache.openjpa.persistence.OptimisticLockException extends
javax.persistence.OptimisticLockException, so a catch block for
javax.persistence.OptimisticLockException will still catch it.

verkehr wrote:
> I'm using openejb 3.1.1 with includes openjpa. I'm annotating an Integer
> field with "@Version". 
> Every time I'm querying a row (e.g. calling "ejb.getById()") will cause an
> update of the row with a new version! A call to "ejb.getAll()" (which
> retrieves all rows as a java.util.List) updates all rows with a new
> version number!!
> In my opinion nn update of the version field (column) should only occur
> calling "persist()". - Hibernate does so! JPA specification chapter 3.4.
> says it too.
> Is there a parameter to set that changes this behaviour.
> Further, openjpa throws an
> org.apache.openjpa.persistence.OptimisticLockException and not
> javax.persistence.OptimisticLockException
> Why? This prohibits protability. Hibernate throws
> javax.persistence.OptimisticLockException
> -- 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message