1

As I understand, JPA 1.0 LockModeType.write works with field annotated @Version.

This field is incremented each time, when entity is read or written. But how JPA works when this field is absent?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Balconsky
  • 2,234
  • 3
  • 26
  • 39
  • http://alvinalexander.com/java/jwarehouse/hibernate/hibernate-core/src/matrix/java/org/hibernate/test/jpa/lock/JPALockTest.java.shtml – Sunny Gupta May 21 '13 at 08:08

2 Answers2

1

Take a look at Field Locking. When using field locking fields are compared when updating.

Take a look at here.

Ortwin Angermeier
  • 5,957
  • 2
  • 34
  • 34
0

Lock mode only applies to entities configured with an @Version. It will either throw an error, or have no affect without a version.

JPA 2 also defines pessimistic locking, and some JPA providers provide other forms of locking.

James
  • 17,965
  • 11
  • 91
  • 146