HHH-12555 Add a DialectCheck for NClob support
This commit is contained in:
parent
4d0b5dc184
commit
855f34c771
|
@ -6,6 +6,11 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.nationalized;
|
package org.hibernate.test.nationalized;
|
||||||
|
|
||||||
|
import static junit.framework.TestCase.assertNotNull;
|
||||||
|
import static junit.framework.TestCase.fail;
|
||||||
|
import static org.hamcrest.core.Is.is;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Lob;
|
import javax.persistence.Lob;
|
||||||
|
@ -15,30 +20,18 @@ import org.hibernate.Session;
|
||||||
import org.hibernate.annotations.Nationalized;
|
import org.hibernate.annotations.Nationalized;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.dialect.DB2Dialect;
|
|
||||||
import org.hibernate.dialect.MySQLDialect;
|
|
||||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
|
||||||
import org.hibernate.dialect.SybaseDialect;
|
|
||||||
import org.hibernate.resource.transaction.spi.TransactionStatus;
|
import org.hibernate.resource.transaction.spi.TransactionStatus;
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.SkipForDialect;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertNotNull;
|
|
||||||
import static junit.framework.TestCase.fail;
|
|
||||||
import static org.hamcrest.core.Is.is;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-10364")
|
@TestForIssue(jiraKey = "HHH-10364")
|
||||||
@SkipForDialect(value = DB2Dialect.class, comment = "DB2 jdbc driver doesn't support getNClob")
|
@RequiresDialectFeature(DialectChecks.SupportsNClob.class)
|
||||||
@SkipForDialect(value = MySQLDialect.class, comment = "MySQL/MariadB doesn't support nclob")
|
|
||||||
@SkipForDialect(value = PostgreSQL81Dialect.class, comment = "PostgreSQL doesn't support nclob")
|
|
||||||
@SkipForDialect(value = SybaseDialect.class, comment = "Sybase doesn't support nclob")
|
|
||||||
public class NationalizedLobFieldTest extends BaseCoreFunctionalTestCase {
|
public class NationalizedLobFieldTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,6 +8,9 @@ package org.hibernate.testing;
|
||||||
|
|
||||||
import org.hibernate.dialect.DB2Dialect;
|
import org.hibernate.dialect.DB2Dialect;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.dialect.MySQLDialect;
|
||||||
|
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||||
|
import org.hibernate.dialect.SybaseDialect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container class for different implementation of the {@link DialectCheck} interface.
|
* Container class for different implementation of the {@link DialectCheck} interface.
|
||||||
|
@ -256,4 +259,16 @@ abstract public class DialectChecks {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class SupportsNClob implements DialectCheck {
|
||||||
|
@Override
|
||||||
|
public boolean isMatch(Dialect dialect) {
|
||||||
|
return !(
|
||||||
|
dialect instanceof DB2Dialect ||
|
||||||
|
dialect instanceof PostgreSQL81Dialect ||
|
||||||
|
dialect instanceof SybaseDialect ||
|
||||||
|
dialect instanceof MySQLDialect
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue