@Test public void testIsActiveReturnFalseIfNoTransactionHasBeenCreated() throws ODataJPATransactionException { cut = new JPAODataDefaultTransactionFactory(em); assertFalse(cut.hasActiveTransaction()); }
@Override public boolean hasActiveTransaction() { try { final boolean baseActive = em.getTransaction().isActive(); if (currentTransaction == null && !baseActive) return false; else if (currentTransaction == null) return true; return currentTransaction.isActive(); } catch (RuntimeException | ODataJPATransactionException e) { return true; } }
JPAODataDefaultTransactionFactory implements JPAODataTransactionFactory { @Override public boolean hasActiveTransaction() { try { final boolean baseActive = em.getTransaction().isActive(); if (currentTransaction == null && !baseActive) return false; else if (currentTransaction == null) return true; return currentTransaction.isActive(); } catch (RuntimeException | ODataJPATransactionException e) { return true; } } }
JPAODataDefaultTransactionFactory implements JPAODataTransactionFactory { @Override public boolean hasActiveTransaction() { try { final boolean baseActive = em.getTransaction().isActive(); if (currentTransaction == null && !baseActive) return false; else if (currentTransaction == null) return true; return currentTransaction.isActive(); } catch (RuntimeException | ODataJPATransactionException e) { return true; } } JPAODataDefaultTransactionFactory(@Nonnull final EntityManager em); }
JPAODataDefaultTransactionFactory implements JPAODataTransactionFactory { @Override public boolean hasActiveTransaction() { try { final boolean baseActive = em.getTransaction().isActive(); if (currentTransaction == null && !baseActive) return false; else if (currentTransaction == null) return true; return currentTransaction.isActive(); } catch (RuntimeException | ODataJPATransactionException e) { return true; } } JPAODataDefaultTransactionFactory(@Nonnull final EntityManager em); @Override JPAODataTransaction createTransaction(); @Override boolean hasActiveTransaction(); }
JPAODataDefaultTransactionFactory implements JPAODataTransactionFactory { @Override public boolean hasActiveTransaction() { try { final boolean baseActive = em.getTransaction().isActive(); if (currentTransaction == null && !baseActive) return false; else if (currentTransaction == null) return true; return currentTransaction.isActive(); } catch (RuntimeException | ODataJPATransactionException e) { return true; } } JPAODataDefaultTransactionFactory(@Nonnull final EntityManager em); @Override JPAODataTransaction createTransaction(); @Override boolean hasActiveTransaction();  }