HHH-6851 DB2 doesn't support NotNullUnique causes org.hibernate.test.annotations.uniqueconstraint.UniqueConstraintTest.testUniquenessConstraintWithSuperclassProperty fail

This commit is contained in:
Strong Liu 2011-11-26 00:15:05 +08:00
parent b42d5f7691
commit d7f3042e5b
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import org.junit.Test;
import org.hibernate.JDBCException; import org.hibernate.JDBCException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -23,6 +25,7 @@ public class UniqueConstraintTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@RequiresDialectFeature( DialectChecks.SupportNotNullUnique.class )
public void testUniquenessConstraintWithSuperclassProperty() throws Exception { public void testUniquenessConstraintWithSuperclassProperty() throws Exception {
Session s = openSession(); Session s = openSession();
Transaction tx = s.beginTransaction(); Transaction tx = s.beginTransaction();

View File

@ -92,6 +92,12 @@ abstract public class DialectChecks {
} }
} }
public static class SupportNotNullUnique implements DialectCheck {
public boolean isMatch(Dialect dialect) {
return dialect.supportsNotNullUnique();
}
}
public static class SupportLimitCheck implements DialectCheck { public static class SupportLimitCheck implements DialectCheck {
public boolean isMatch(Dialect dialect) { public boolean isMatch(Dialect dialect) {
return dialect.supportsLimit(); return dialect.supportsLimit();