title: Are entities fetched outside transaction managed or detached?
body: <p>I always thought that entities fetched before a transaction (before <code>entityManager.getTransaction().begin()</code>) were detached from the persistence context (while using the same entity manager to fetch entities as to handle the transaction). In fact, every time I was managing transactions, I had to explicitly merge entities that were fetched outside of it. If I didn't, updates were not reflected in the database.</p>
  
  <p>But recently, I had a discussion with a colleague who experienced this situation the opposite way. He had to explicitly detach every entities fetched before transaction to avoid updating database.</p>
  
  <p>The only difference between our codes is that my <code>persistence.xml</code> file is version 2.0 and his is version 1.0. But he is using JPA 2.1 in his code. Is that the reason for this strange behavior or is there something I'm missing here?</p>
  
  <p>We both use Hibernate as implementation.</p>