Code example for EntityManagerHolder

0
            } 
        } 
        else 
        { 
            em = createEntityManager(emf); 
            TransactionSynchronizationManager.bindResource(emf, new EntityManagerHolder(em)); 
        } 
 
        return em; 
    } 
 
    protected void commitActiveTransaction(final EntityManager em) 
    { 
        if (em.getTransaction().isActive()) 
        { 
            em.getTransaction().commit(); 
        } 
    } 
 
    protected void rollbackActiveTransaction(final EntityManager em) 
Connect your IDE to all the code out there  Get Codota for Java