Upgrade to JPA 2.1+ and Bean Validation 1.1+; remove native support for Hibernate 3.6 and 4.x
Issue: SPR-13481 Issue: SPR-13827
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.test.context.junit4.orm;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.exception.ConstraintViolationException;
|
||||
import org.junit.Before;
|
||||
@@ -107,10 +109,16 @@ public class HibernateSessionFlushingTests extends AbstractTransactionalJUnit4Sp
|
||||
}
|
||||
|
||||
@Test(expected = ConstraintViolationException.class)
|
||||
public void updateSamWithNullDriversLicenseWithSessionFlush() {
|
||||
public void updateSamWithNullDriversLicenseWithSessionFlush() throws Throwable {
|
||||
updateSamWithNullDriversLicense();
|
||||
// Manual flush is required to avoid false positive in test
|
||||
sessionFactory.getCurrentSession().flush();
|
||||
try {
|
||||
sessionFactory.getCurrentSession().flush();
|
||||
}
|
||||
catch (PersistenceException ex) {
|
||||
// Wrapped in Hibernate 5.2, with the constraint violation as cause
|
||||
throw ex.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user