clean up weird code formatting in test
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
7f89c6260e
commit
59603dffb3
|
@ -178,10 +178,14 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
}
|
||||
|
||||
txn.commit();
|
||||
} catch (RuntimeException e) {
|
||||
if (txn != null && txn.isActive()) txn.rollback();
|
||||
throw e;
|
||||
} finally {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
if (txn != null && txn.isActive()) {
|
||||
txn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
if (entityManager != null) {
|
||||
entityManager.close();
|
||||
}
|
||||
|
@ -214,10 +218,14 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
}
|
||||
|
||||
txn.commit();
|
||||
} catch (RuntimeException e) {
|
||||
if (txn != null && txn.isActive()) txn.rollback();
|
||||
throw e;
|
||||
} finally {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
if (txn != null && txn.isActive()) {
|
||||
txn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
if (entityManager != null) {
|
||||
entityManager.close();
|
||||
}
|
||||
|
@ -242,10 +250,10 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
|
||||
Session session = entityManager.unwrap(Session.class);
|
||||
|
||||
scrollableResults = session
|
||||
.createSelectionQuery("select p from Person p")
|
||||
.setCacheMode(CacheMode.IGNORE)
|
||||
.scroll(ScrollMode.FORWARD_ONLY);
|
||||
scrollableResults =
|
||||
session.createSelectionQuery("select p from Person p")
|
||||
.setCacheMode(CacheMode.IGNORE)
|
||||
.scroll(ScrollMode.FORWARD_ONLY);
|
||||
|
||||
int count = 0;
|
||||
while (scrollableResults.next()) {
|
||||
|
@ -259,10 +267,14 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
}
|
||||
|
||||
txn.commit();
|
||||
} catch (RuntimeException e) {
|
||||
if (txn != null && txn.isActive()) txn.rollback();
|
||||
throw e;
|
||||
} finally {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
if (txn != null && txn.isActive()) {
|
||||
txn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
if (scrollableResults != null) {
|
||||
scrollableResults.close();
|
||||
}
|
||||
|
@ -279,7 +291,7 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
//tag::batch-stateless-session-example[]
|
||||
StatelessSession statelessSession = null;
|
||||
Transaction txn = null;
|
||||
ScrollableResults scrollableResults = null;
|
||||
ScrollableResults<?> scrollableResults = null;
|
||||
try {
|
||||
SessionFactory sessionFactory = entityManagerFactory().unwrap(SessionFactory.class);
|
||||
statelessSession = sessionFactory.openStatelessSession();
|
||||
|
@ -287,9 +299,9 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
txn = statelessSession.getTransaction();
|
||||
txn.begin();
|
||||
|
||||
scrollableResults = statelessSession
|
||||
.createSelectionQuery("select p from Person p")
|
||||
.scroll(ScrollMode.FORWARD_ONLY);
|
||||
scrollableResults =
|
||||
statelessSession.createSelectionQuery("select p from Person p")
|
||||
.scroll(ScrollMode.FORWARD_ONLY);
|
||||
|
||||
while (scrollableResults.next()) {
|
||||
Person Person = (Person) scrollableResults.get();
|
||||
|
@ -298,10 +310,14 @@ public class BatchTests extends BaseEntityManagerFunctionalTestCase {
|
|||
}
|
||||
|
||||
txn.commit();
|
||||
} catch (RuntimeException e) {
|
||||
if (txn != null && txn.getStatus() == TransactionStatus.ACTIVE) txn.rollback();
|
||||
throw e;
|
||||
} finally {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
if (txn != null && txn.getStatus() == TransactionStatus.ACTIVE) {
|
||||
txn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
if (scrollableResults != null) {
|
||||
scrollableResults.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue