Thanks Alexey
I have never configured optimistic locking b4 but it sounds quite interesting, So I am currently trying to learn it. I found a good pdf on the net about JbossCMP(http://www.ime.usp.br/~reverbel/SOD/maillist/pdf00000.pdf) but it does not seem to say anything about optimistic locking, do u know where I could find any resource that could help me learn more on the above.By the way I also found an old posting of urs on this list concerning the configuration of the above.
Lastly could I ask if u know of a non jboss specific way to know when a CMP Bean is modified??
Thank
Edward
BELOW IS A COPY OF UR OLD POSTING
- From: Alex Loubyansky
- Subject: [JBoss-user] Optimistic locking ported to JBoss-3.2
- Date: Thu, 26 Dec 2002 01:03:00 -0800
To setup optimistic locking, container configuration element locking-policy should be set to <locking-policy>org.jboss.ejb.plugins.lock.JDBCOptimisticLock</locking-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> alex
Alexey Loubyansky <[EMAIL PROTECTED]> wrote:
There is an optimistic locking strategy that could be what you are intersted in. It is configured in jbosscmp-jdbc.xml<optimistic-locking>
<timestamp-column/>
<field-name>version</field-name>
<column-name>ol_timestamp</column-name>
<jdbc-type>TIMESTAMP</jdbc-type>
<sql-type>DATETIME</sql-type>
</optimistic-locking>
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ed banfa
Sent: Thursday, January 15, 2004 6:06 PM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Knowing when a CMP bean is modifiedHello all,I would like to know when my CMP bean has been modified so as to keep a last modifiedmarker on the bean, I would like to keep track of the exact time a record was updated.Has anybody done similar work?I would apreciate any advice/tips.Thanks in advanceEd
EDWARD BANFA
NETPLAY TECHNOLOGIES INC.
JOS, PLATEAU STATE
NIGERIA.
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
EDWARD BANFA
NETPLAY TECHNOLOGIES INC.
JOS, PLATEAU STATE
NIGERIA.
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes