If we see a JBC DefaultDataVersion, we are newer

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14374 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Brian Stansberry 2008-02-27 21:13:24 +00:00
parent 0d6232c0b8
commit 3d0c9705b0
1 changed files with 8 additions and 7 deletions

View File

@ -89,15 +89,16 @@ public class DataVersionAdapter implements DataVersion {
log.trace("skipping lock checks..."); log.trace("skipping lock checks...");
return false; return false;
} else if (dataVersion instanceof DefaultDataVersion) { } else if (dataVersion instanceof DefaultDataVersion) {
if (((DefaultDataVersion) dataVersion).getRawVersion() == 0) { // JBC put a version in the node when it created as part of
// JBC put a version in the node when it created it as // some internal operation. We are always newer, but if
// part of building a larger tree // the JBC version is > 1 something odd has happened
return true; if (((DefaultDataVersion) dataVersion).getRawVersion() > 1) {
} else { log.warn("Unexpected comparison to " + dataVersion +
log.error("Cannot compare to " + dataVersion); " -- we are " + toString());
return false;
} }
return true;
} }
DataVersionAdapter other = (DataVersionAdapter) dataVersion; DataVersionAdapter other = (DataVersionAdapter) dataVersion;
if (other.previousVersion == null) { if (other.previousVersion == null) {
log.warn("Unexpected optimistic lock check on inserting data"); log.warn("Unexpected optimistic lock check on inserting data");