openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <>
Subject [jira] Commented: (OPENJPA-891) JPA2 LockTypeMode Support
Date Sun, 08 Mar 2009 16:23:56 GMT


Albert Lee commented on OPENJPA-891:

More testing reveals there exist 2 problems in the current implementations:

1) e.lock() does not honor the following contract

* @throws IllegalArgumentException if the instance is not an entity or is a detached entity,

      e = em.lock(null,LockModeType.XXX);
      e = em.lock("xxxx",LockModeType.XXX);

2) e.refresh does not honor the WRITE lock contract.

3.4.3 Lock Modes
"If transaction T1 calls lock(entity, LockModeType.WRITE) on a versioned object, the entity
manager must avoid the phenomena P1 and P2 (as with  LockModeType.READ) and must also force
an update (increment) to the entity's version column. A forced version update may be performed
immediately, or may be deferred until a flush or commit." E.g.

     e = em.find(Entity.class, 1);
     em.refresh(e, LockModeType.WRITE)

does not update the version field on commit. but the lock did force the version to be updated.
     e = em.find(Entity.class, 1);
     em.lock(e, LockModeType.WRITE)

More corrective patch and test cases will be posted later.
Albert Lee.

> JPA2 LockTypeMode Support
> -------------------------
>                 Key: OPENJPA-891
>                 URL:
>             Project: OpenJPA
>          Issue Type: Sub-task
>          Components: jpa
>    Affects Versions: 2.0.0
>            Reporter: Albert Lee
>            Assignee: Albert Lee
>             Fix For: 2.0.0

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

View raw message