title: Does Guice Persist provide transaction scoped or application managed EntityManager?
body: <p>We use <a href="https://code.google.com/p/google-guice/wiki/GuicePersist" rel="noreferrer">Guice Persist</a> to inject EntityManager in our project.</p>
  
  <p>E.g.</p>
  
  <pre><code>public class MyDao{
     @Inject
     EntityManager em;
  
     public void someMethod(){
         //uses em instance
     }
  }
  </code></pre>
  
  <p>But it is unclear for us how injected instance of <code>EntityManager</code> is about to be used.</p>
  
  <ol>
  <li><strong>What type of EntityManager is this?</strong> (see e.g.: <a href="http://piotrnowicki.com/2012/11/types-of-entitymanagers-application-managed-entitymanager/" rel="noreferrer">types of entity managers</a>) Under the hood Guice Persist instantiates it via <code>EntityManagerFactory.createEntityManager()</code> so I'd say it's application-managed entity manager. But in <a href="https://code.google.com/p/google-guice/wiki/JPA" rel="noreferrer">official Wiki</a> they write about <em>seesion-per-transaction</em> strategy, which suggests that EntityManager is (pseudo) transaction-scoped.</li>
  <li><strong>Should we invoke close() on it manually</strong>? Or Guice will take care of it?</li>
  <li><strong>What is the scope of <a href="http://en.wikibooks.org/wiki/Java_Persistence/Caching#1st_Level_Cache" rel="noreferrer">first level cache</a>?</strong> Only single transaction (like in transaction-scoped entity managers) or as long as I use the same injected instance of <code>EntityManager</code> (like in application managed entity managers)?</li>
  </ol>