Change Notes item #658609, was opened at 2002-12-26 10:46
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381174&aid=658609&group_id=22866

Category: JBossCMP
Group: v3.2
Status: Open
Priority: 5
Submitted By: Alexey Loubyansky (loubyansky)
Assigned to: Nobody/Anonymous (nobody)
Summary: Optimistic locking support

Initial Comment:
To setup optimistic locking, container configuration 
element locking-policy should be set to
<locking-
policy>org.jboss.ejb.plugins.lock.JDBCOptimisticLock</l
ocking-policy>
and entity element in jbosscmp-jdbc.xml should have 
optimistic-locking element.

Following are the possible configurations of optimistic-
locking element:
1. Fixed group of fields that will be used for optimistic 
locking.
   <optimistic-locking>
      <group-name>optimisticLockingGroup</group-
name>
   </optimistic-locking>
where optimisticLockingGroup is one of the entity's load-
group-name's.

2. Modified strategy. The fields that were modified during 
transaction will be used for optimistic locking.
   <optimistic-locking>
      <modified-strategy/>
   </optimistic-locking>

3. Read strategy. The fields that were read during 
transaction will be used for optimistic locking.
   <optimistic-locking>
      <read-strategy/>
   </optimistic-locking>

4. Version (counter) column strategy. Additional version 
(counter) field of type java.lang.Long will be added to 
entity which 

will be used for optimistic locking. Each update of the 
entity will increase the value of its version field by 1.
   <optimistic-locking>
      <version-column/>
      <field-name>versionField</field-name>
      <column-name>ol_version</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER(5)</sql-type>
   </optimistic-locking>

5. Timestamp column strategy. Additional timestamp 
column field of type java.util.Date will be added to entity 
which will be 

used for optimistic locking. Each update of the entity will 
set the value of its timestamp field to the current time.
   <optimistic-locking>
      <timestamp-column/>
      <field-name>timestampField</field-name>
      <column-name>ol_timestamp</column-name>
      <jdbc-type>TIMESTAMP</jdbc-type>
      <sql-type>DATETIME</sql-type>
   </optimistic-locking>

6. Version column generated by KeyGenerator. 
Additional field will be added to entity that will be used 
for optimistic 

locking. Each update of the entity will update its version 
column with value generated by KeyGenerator.
   <optimistic-locking>
      <key-generator-
factory>UUIDKeyGeneratorFactory</key-generator-
factory>
      <field-type>java.lang.String</field-type>
      <field-name>uuidField</field-name>
      <column-name>ol_uuid</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(32)</sql-type>
   </optimistic-locking>


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381174&aid=658609&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to