SchemaUpdateTest should be skipped with Sybase

Description

org.hibernate.test.schemaupdate.SchemaUpdateTest

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Caused by: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table "TESTentity" (id bigint not null, "FieLd1" varchar(255) null, "FIELD_2" varchar(255) null, "field_3" varchar(255) null, field4 varchar(255) null, primary key (id)) lock datarows" via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559) ... 63 more Caused by: com.sybase.jdbc4.jdbc.SybSQLException: There is already an object named 'TESTentity' in the database. at com.sybase.jdbc4.tds.Tds.processEed(Tds.java:4003) at com.sybase.jdbc4.tds.Tds.nextResult(Tds.java:3093) at com.sybase.jdbc4.jdbc.ResultGetter.nextResult(ResultGetter.java:78) at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:289) at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:271) at com.sybase.jdbc4.jdbc.SybStatement.executeLoop(SybStatement.java:2593) at com.sybase.jdbc4.jdbc.SybStatement.execute(SybStatement.java:2580) at com.sybase.jdbc4.jdbc.SybStatement.execute(SybStatement.java:1292) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ... 64 more

Test already contains two checks whether database uses case-insensitive quoted identifiers.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Databases that use case-insensitive quoted identifiers need to be skipped. // The following checks will work for checking those dialects that store case-insensitive // quoted identifiers as upper-case or lower-case. It does not work for dialects that // store case-insensitive identifiers in mixed case (like SQL Server). final IdentifierHelper identifierHelper = ssr.getService( JdbcEnvironment.class ).getIdentifierHelper(); final String lowerCaseName = identifierHelper.toMetaDataObjectName( Identifier.toIdentifier( "testentity", true ) ); final String upperCaseName = identifierHelper.toMetaDataObjectName( Identifier.toIdentifier("TESTENTITY", true ) ); final String mixedCaseName = identifierHelper.toMetaDataObjectName( Identifier.toIdentifier("TESTentity", true ) ); if ( lowerCaseName.equals( upperCaseName ) || lowerCaseName.equals( mixedCaseName ) || upperCaseName.equals( mixedCaseName ) ) { StandardServiceRegistryBuilder.destroy( ssr ); skipTest = true; }

and

1 2 3 4 5 6 if(SQLServerDialect.class.isAssignableFrom( Dialect.getDialect().getClass() )) { // SQLServerDialect stores case-insensitive quoted identifiers in mixed case, // so the checks at the end of this method won't work. skipTest = true; return; }

Since first check doesn't work for Sybase, the same approach as for SQL Server should be applied to Sybase.

Environment

Sybase

Status

Assignee

Martin Šimka

Reporter

Martin Šimka

Fix versions

Labels

backPortable

Backport?

Suitable for new contributors

Yes, likely

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.3.3

Priority

Major
Configure