HHH-12802 : Fix test case to recover from exception properly

(cherry picked from commit 9202a5a11d56ca6565963f3f9aa59b92421ec5fb)
This commit is contained in:
Gail Badner 2018-07-13 15:51:39 -07:00
parent 3af8b6235a
commit 7e69797a45

View File

@ -57,18 +57,18 @@ public void setup() {
@Test
@TestForIssue( jiraKey = "HHH-12802" )
public void testLoadEntityWithNonUniqueId() {
doInHibernate(
this::sessionFactory,
session -> {
try {
session.get( Category.class, 1 );
fail( "should have failed because there are 2 entities with id == 1" );
try {
doInHibernate(
this::sessionFactory,
session -> {
session.get( Category.class, 1 );
fail( "should have failed because there are 2 entities with id == 1" );
}
catch ( HibernateException ex) {
// expected
}
}
);
);
}
catch ( HibernateException ex) {
// expected
}
}
@Entity