title: entitymanager, transaction in transaction
body: <p>I have such code :</p>
  
  <pre><code>   public void createTerminal(TerminalDo terminalDo) {
          final EntityManagerFactory emf = JpaFactory.getEntityManagerFactory();
          final EntityManager em = emf.createEntityManager();
          EntityTransaction etx = null;
          try {
              etx = em.getTransaction();
              etx.begin();
  
              // persist method make the passed Object stored in the persistence
              // context
              em.persist(terminalDo);
  
              etx.commit();
          } catch (Exception e) {
              if (etx != null &amp;&amp; etx.isActive())
                  etx.rollback();
              e.printStackTrace();
          } finally {
              em.close();
          }
     }
  </code></pre>
  
  <p>This is a transactional method.
  I don't know if it's possible to create another transactional method calling this already transactional one,
  then nesting an entity-managed transaction into another one,
  and is it a good practice ?</p>
  
  <pre><code>       public void makeAllThat(TerminalDo terminalDo, ApplicationDo applicationDo) {
              final EntityManagerFactory emf = JpaFactory.getEntityManagerFactory();
              final EntityManager em = emf.createEntityManager();
              EntityTransaction etx = null;
              try {
                  etx = em.getTransaction();
                  etx.begin();
  
                  createTerminal(terminalDo);
                  createApplication(applicationDo);
                  //do many other transactions...
                  .....
  
                  etx.commit();
              } catch (Exception e) {
                  if (etx != null &amp;&amp; etx.isActive())
                      etx.rollback();
                  e.printStackTrace();
              } finally {
                  em.close();
              }
         }
  </code></pre>