HHH-13724 Fix failing tests

This commit is contained in:
Andrea Boriero 2020-07-25 15:31:52 +01:00
parent 7dba4c2a61
commit e60299c440
2 changed files with 17 additions and 3 deletions

View File

@ -36,7 +36,7 @@ public class HHH14112Test extends BaseCoreFunctionalTestCase {
@Entity(name = "Super")
@Inheritance(strategy = InheritanceType.JOINED)
@Where(clause = "DELETED = 0")
@Where(clause = "DELETED = false")
public static class Super {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)

View File

@ -18,6 +18,7 @@ import javax.persistence.OptimisticLockException;
import javax.persistence.Version;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.CockroachDB192Dialect;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.junit.Test;
@ -91,8 +92,21 @@ public class BatchOptimisticLockingTest extends
} );
}
catch (Exception expected) {
assertEquals( OptimisticLockException.class, expected.getClass());
assertEquals( "Batch update returned unexpected row count from update [1]; actual row count: 0; expected: 1; statement executed: update Person set name=?, version=? where id=? and version=?", expected.getMessage() );
assertEquals( OptimisticLockException.class, expected.getClass() );
if ( getDialect() instanceof CockroachDB192Dialect ) {
// CockroachDB always runs in SERIALIZABLE isolation, and uses SQL state 40001 to indicate
// serialization failure.
assertEquals(
"org.hibernate.exception.LockAcquisitionException: could not execute batch",
expected.getMessage()
);
}
else {
assertEquals(
"Batch update returned unexpected row count from update [1]; actual row count: 0; expected: 1; statement executed: update Person set name=?, version=? where id=? and version=?",
expected.getMessage()
);
}
}
}