Thanks for your reply, Armin.

Using a debugger I found that RepositoryXmlHandler sets updateLock to false when "update-lock" is not specified.

Here is how it assigns a value to the updateLock attribute of the current field descriptor object in RepositoryXmlHandler#startElement():

String updateLock = atts.getValue(tags.getTagById(UPDATE_LOCK));
if (isDebug) logger.debug(" " + tags.getTagById(UPDATE_LOCK) + ": " + updateLock);
b = (Boolean.valueOf(updateLock)).booleanValue();
m_CurrentFLD.setUpdateLock(b);


In statement 3 above, valueOf() will return false when updateLock parsed from XML is null. Examining RepositoryXmlHandler's debug logs indicates that null is indeed assigned to updateLock when the parsed attribute is missing.

Statement 4 above will set updateLock in the field descriptor to false when "update-lock" is missing in the mapping file, and reverse the initial value of true for "updateLock" in the FieldDescriptor class.

What's your take on this?

Thanks,

Pulat

Armin Waibel wrote:

Hi Pulat,

I checked the initialization value for 'updateLock' in FieldDescriptor class and it's 'true'. So if you don't specify a value the xml-parser should return 'true' or if this attribute was skipped the initial value (true) should be used in FieldDescriptor.

In OJB test-suite are several locking tests (OptimisticLockingTest.java) and all tests pass.

Maybe it's a parser/repository.dtd problem. You can enable OJB parsing result when change log-level for class RepositoryXmlHandler.java to 'debug'.
When using OJB default logger simply change entry for this class to 'debug' in OJB-logging.properties


regards,
Armin


Pulat Yunusov wrote:

I found that update-lock is false by default, that is when I don't specify it in the locking field descriptor. When I set this attribute to true explicitly, OJB increments the version field for every insert and update.

I inspected the class-descriptor object passed to storeToDb() in PersistenceBrokerImpl#store() with a debugger, and its m_lockingFieldDescriptors attribute contained a FieldDescriptor object with the value of updateLock attribute equal to false. However, update-lock was not specified for that locking field in the class-descriptor in my mapping file.

According to the DTD at http://db.apache.org/ojb/repository.dtd.txt, the default value of update-lock is true. I am using OJB 1.0.0. Have I found a bug, and has anybody else experienced this?

Thanks,

Pulat

Pulat Yunusov wrote:

According to the OJB FAQ the version column "is incremented each time changes are committed to the object". The version column is the column described in field-descriptors with the "locking" attribute set to true.

However, I have never ever seen values in this column other than the default of zero. I assume this value should constantly grow with every update to the record but I have never seen that happen.

What is wrong?

Thank you,

Pulat

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to