Merge remote-tracking branch 'upstream/main' into wip/6.0

This commit is contained in:
Andrea Boriero 2021-09-17 15:33:08 +02:00
commit 6519b3bfcd
2 changed files with 21 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.exception.LockTimeoutException;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
@ -229,6 +230,8 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException {
if ( dbMetaData == null ) {
// TODO: if DatabaseMetaData != null, unquoted case strategy is set to IdentifierCaseStrategy.UPPER
// Check to see if this setting is correct.
builder.setUnquotedCaseStrategy( IdentifierCaseStrategy.MIXED );
builder.setQuotedCaseStrategy( IdentifierCaseStrategy.MIXED );
}
@ -767,4 +770,10 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
return super.getDropSchemaCommand( schemaName );
}
@Override
public NameQualifierSupport getNameQualifierSupport() {
return NameQualifierSupport.BOTH;
}
}

View File

@ -15,6 +15,7 @@ import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.PessimisticLockException;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.QueryTimeoutException;
import org.hibernate.exception.LockAcquisitionException;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
@ -58,6 +59,17 @@ public class PostgreSQL81DialectTestCase extends BaseUnitTestCase {
assertTrue(exception instanceof PessimisticLockException);
}
@Test
@TestForIssue( jiraKey = "HHH-13661")
public void testQueryTimeoutException() {
final PostgreSQL81Dialect dialect = new PostgreSQL81Dialect();
final SQLExceptionConversionDelegate delegate = dialect.buildSQLExceptionConversionDelegate();
assertNotNull( delegate );
final JDBCException exception = delegate.convert( new SQLException("Client cancelled operation", "57014"), "", "" );
assertTrue( exception instanceof QueryTimeoutException );
}
/**
* Tests that getForUpdateString(String aliases, LockOptions lockOptions) will return a String
* that will effect the SELECT ... FOR UPDATE OF tableAlias1, ..., tableAliasN