Hi,
We have a certain background daemon which will use Lucene to index some records being updated. To prevent re-indexing records that have not been changed, the daemon will update a "lastIndexedAt" field after the record is indexed.
The data record classes are applying Hibernate's optimistic version-stamp locking. This frequently causes StaleObjectException at either the daemon or the main operation server because record's version has ben updated by either side.
Because this "lastIndexedAt" field are not used for other purpose and it is not essential for it be to absolutely transaction-safe, we believe the index daemon can just use pessemistic locking to update this particular field without changing the version stamp at the same time.
However, I have not found a call that seem to temporarily disable the version stamp update.
Alternatively, we can acquire the SQL connection and emit SQL statement like
update r.lastIndexedAt = {} from <ClassTbl> where ...
This would work but we must first figure out the table name which is made complicate due to our use of multi-table inheritance mapping.
We hope someone can point us the simplest possible way to update this simple field without updating the version field.
Thanks
_________________ Hacking Bear
|