package com.fitbank.common.dialect; import org.hibernate.LockMode; import org.hibernate.dialect.SQLServerDialect; public class FITSQLServerDialect extends SQLServerDialect { public String getForUpdateString() { return " with (rowlock) "; } public String transformSelectString(String select) { int index = 0; if (select.contains("where")) { index = select.indexOf("where"); } else if (select.contains("WHERE")) { index = select.indexOf("WHERE"); } return select.substring(0, index) + this.getForUpdateString() + select.substring(index); } public String appendLockHint(LockMode mode, String tableName) { if ( mode.greaterThan( LockMode.READ ) ) { // does this need holdlock also? : return tableName + " with (updlock, rowlock, holdlock)"; return tableName + " with (rowlock) "; } else { return tableName; } } }