From ca0eee08a0e6d3ab183136905cca4229f8d4e620 Mon Sep 17 00:00:00 2001 From: Martin Simka Date: Tue, 18 Aug 2015 17:27:13 +0200 Subject: [PATCH] HHH-9995 - Finish pgsql database profile - rollback transaction on error in TestLazyBasicFieldAccessExecutable --- .../TestLazyBasicFieldAccessExecutable.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/TestLazyBasicFieldAccessExecutable.java b/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/TestLazyBasicFieldAccessExecutable.java index 0d75f7c9bb..1bff66a384 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/TestLazyBasicFieldAccessExecutable.java +++ b/hibernate-core/src/test/java/org/hibernate/test/instrument/cases/TestLazyBasicFieldAccessExecutable.java @@ -16,7 +16,7 @@ public class TestLazyBasicFieldAccessExecutable extends AbstractExecutable { return new String[] {"org/hibernate/test/instrument/domain/Documents.hbm.xml"}; } - public void execute() { + public void execute() throws Exception { Session s = getFactory().openSession(); Transaction t = s.beginTransaction(); Owner o = new Owner(); @@ -51,10 +51,16 @@ public class TestLazyBasicFieldAccessExecutable extends AbstractExecutable { doc.setName( "Doc Name 1" ); doc.setSummary( "v" ); Document docManaged = (Document) s.merge( doc ); - Assert.assertEquals( "v", docManaged.getSummary() ); - Assert.assertTrue( Hibernate.isPropertyInitialized( docManaged, "summary" ) ); - s.getTransaction().commit(); - s.close(); + try { + Assert.assertEquals("v", docManaged.getSummary()); + Assert.assertTrue( Hibernate.isPropertyInitialized( docManaged, "summary" ) ); + s.getTransaction().commit(); + } catch (Exception e) { + s.getTransaction().rollback(); + throw e; + } finally { + s.close(); + } s = getFactory().openSession(); s.getTransaction().begin();