Fix Sybase ASE nightly failure of NationalizedTest

This commit is contained in:
Christian Beikov 2024-11-20 19:26:13 +01:00
parent de3408662c
commit ed5f1d82d1
2 changed files with 13 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import jakarta.persistence.Id;
import org.hibernate.annotations.Nationalized; import org.hibernate.annotations.Nationalized;
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
@ -18,6 +20,7 @@ import static org.junit.Assert.assertEquals;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea
*/ */
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsUnicodeNClob.class)
public class NationalizedTest extends BaseEntityManagerFunctionalTestCase { public class NationalizedTest extends BaseEntityManagerFunctionalTestCase {
@Override @Override

View File

@ -66,6 +66,7 @@ import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SQLServerDialect; import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SpannerDialect; import org.hibernate.dialect.SpannerDialect;
import org.hibernate.dialect.SybaseASEDialect;
import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.SybaseDriverKind; import org.hibernate.dialect.SybaseDriverKind;
import org.hibernate.dialect.TiDBDialect; import org.hibernate.dialect.TiDBDialect;
@ -1023,6 +1024,15 @@ abstract public class DialectFeatureChecks {
} }
} }
public static class SupportsUnicodeNClob implements DialectFeatureCheck {
@Override
public boolean apply(Dialect dialect) {
return !(dialect instanceof SybaseASEDialect aseDialect)
// The jconn driver apparently doesn't support unicode characters
|| aseDialect.getDriverKind() == SybaseDriverKind.JTDS;
}
}
private static final HashMap<Dialect, SqmFunctionRegistry> FUNCTION_REGISTRIES = new HashMap<>(); private static final HashMap<Dialect, SqmFunctionRegistry> FUNCTION_REGISTRIES = new HashMap<>();
public static boolean definesFunction(Dialect dialect, String functionName) { public static boolean definesFunction(Dialect dialect, String functionName) {