diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index f89d123303..9538396dae 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -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; + } + } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/dialect/PostgreSQL81DialectTestCase.java b/hibernate-core/src/test/java/org/hibernate/orm/test/dialect/PostgreSQL81DialectTestCase.java index dad31f6fa2..e339f44d3e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/dialect/PostgreSQL81DialectTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/dialect/PostgreSQL81DialectTestCase.java @@ -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