baliukas wrote:
See optimistic-lock attribute, looks like it can detect conflict without altering database with version field. But I think you will not break legacy applications, if you will add version field to table too (just test it).
Unfortunately it's impossible, as the legacy apps don's use SQL but native apis to access the data, they do not read records and tables as usually but pointers to data, so a new column could crash the system. Instead I was thinking of creating a new table for every legacy table to put the versionID, and map the object to every pair of tables.
While this resolves the extension problem it still does not resolve the data staleness when data modified externally for the reason stated by emmanuel. Do you thing that we could directly configure / modify in some aspect the persistence engine to fit this requirement?
For example by doing an update in which you put all the fields in the where condition instead of only the id and version? If no records affected=>stale data=>exception. The search performance would be not an issue as usually the databases search first for the first field in the where condition (PK) which is fast, and then for the others.
Any idea?