Skip to content

Commit d81f657

Browse files
pb00068stliu
authored andcommitted
Pull-request for HHH-3961
1 parent 606752f commit d81f657

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/SQLServer2005Dialect.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.regex.Matcher;
2828
import java.util.regex.Pattern;
2929

30+
import org.hibernate.LockMode;
3031
import org.hibernate.dialect.function.NoArgSQLFunction;
3132
import org.hibernate.type.StandardBasicTypes;
3233

@@ -196,4 +197,13 @@ protected void insertRowNumberFunction(StringBuilder sql, CharSequence orderby)
196197
// Insert after the select statement the row_number() function:
197198
sql.insert( selectEndIndex - 1, ", ROW_NUMBER() OVER (" + orderby + ") as __hibernate_row_nr__" );
198199
}
200+
201+
@Override // since SQLServer2005 the nowait hint is supported
202+
public String appendLockHint(LockMode mode, String tableName) {
203+
if ( mode == LockMode.UPGRADE_NOWAIT )
204+
{
205+
return tableName + " with (updlock, rowlock, nowait)";
206+
}
207+
return super.appendLockHint(mode, tableName);
208+
}
199209
}

0 commit comments

Comments
 (0)