Optimistic locking: Implement auto-version attributes

Key: CAY-959
URL: https://issues.apache.org/cayenne/browse/CAY-959
Project: Cayenne
Issue Type: Task
Components: Cayenne Core Library, Cayenne JPA
Affects Versions: 3.0
Reporter: Andrus Adamchik
Assignee: Andrus Adamchik
Fix For: 3.0

Per JPA spec , chapter 3.4, we need to support "Version" attribute for optimistic locking. Cayenne already supports optimistic locking, but leaves it up to the user to set the "version" columns. We need to implement auto-versioning on Cayenne end, and bridge it with Cayenne JPA provider.

Cayenne API Tasks:

1. Define ObjAttribute locking type to be LOCK_NONE, LOCK_VERSION, LOCK_MANUAL (make this an enum?)
2. Replace ObjAttribute.usedForLocking property (with deprecation) with the new enum (call it "lockType" or something).
3. Add modeler support for #2.
4. Implement auto-versioning ... the easiest way is probably to use a PRE_PERSIST and PRE_UPDATE callback listener.

JPA Tasks:

5. Bridge JPA @Version mapping with Cayenne mapping (see DataMapConverter).
6. Write integration tests under "jpa-chapter3" module and/or jpa-chpater9 (where @Version annotation is defined).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
postedJan 14, '08 at 11:04a
activeJan 14, '08 at 11:04a

1 user in discussion

Anonymous: 1 post



site design / logo © 2021 Grokbase