parent
dc0cabad5d
commit
64338f2bf1
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
|
import org.hibernate.LockOptions;
|
||||||
import org.hibernate.NullPrecedence;
|
import org.hibernate.NullPrecedence;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.function.CommonFunctionFactory;
|
import org.hibernate.dialect.function.CommonFunctionFactory;
|
||||||
|
@ -57,6 +58,13 @@ public class DB2Dialect extends Dialect {
|
||||||
// * can't select a parameter unless wrapped
|
// * can't select a parameter unless wrapped
|
||||||
// in a cast or function call
|
// in a cast or function call
|
||||||
|
|
||||||
|
private static final String FOR_READ_ONLY_SQL = " for read only with rs";
|
||||||
|
private static final String FOR_SHARE_SQL = FOR_READ_ONLY_SQL + " use and keep share locks";
|
||||||
|
private static final String FOR_UPDATE_SQL = FOR_READ_ONLY_SQL + " use and keep update locks";
|
||||||
|
private static final String SKIP_LOCKED_SQL = " skip locked data";
|
||||||
|
private static final String FOR_SHARE_SKIP_LOCKED_SQL = FOR_SHARE_SQL + SKIP_LOCKED_SQL;
|
||||||
|
private static final String FOR_UPDATE_SKIP_LOCKED_SQL = FOR_UPDATE_SQL + SKIP_LOCKED_SQL;
|
||||||
|
|
||||||
private final int version;
|
private final int version;
|
||||||
|
|
||||||
private LimitHandler limitHandler;
|
private LimitHandler limitHandler;
|
||||||
|
@ -323,9 +331,23 @@ public class DB2Dialect extends Dialect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getReadLockString(int timeout) {
|
||||||
|
return timeout==LockOptions.SKIP_LOCKED
|
||||||
|
? FOR_SHARE_SKIP_LOCKED_SQL
|
||||||
|
: FOR_SHARE_SQL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getWriteLockString(int timeout) {
|
||||||
|
return timeout==LockOptions.SKIP_LOCKED
|
||||||
|
? FOR_UPDATE_SKIP_LOCKED_SQL
|
||||||
|
: FOR_UPDATE_SQL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getForUpdateString() {
|
public String getForUpdateString() {
|
||||||
return " for read only with rs use and keep update locks";
|
return FOR_UPDATE_SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -335,7 +357,7 @@ public class DB2Dialect extends Dialect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getForUpdateSkipLockedString() {
|
public String getForUpdateSkipLockedString() {
|
||||||
return getForUpdateString() + " skip locked data";
|
return FOR_UPDATE_SKIP_LOCKED_SQL;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsOuterJoinForUpdate() {
|
public boolean supportsOuterJoinForUpdate() {
|
||||||
|
|
Loading…
Reference in New Issue