Reputation: 7459
I wonder if these methods are equivalent when shared cache is disabled:
@Stateless
public class EntityService
{
@PersistenceContext
private EntityManager em;
public <T> T findEntity1(Class<T> clazz, long id)
{
return em.find(clazz, id);
}
public <T> T findEntity2(Class<T> clazz, long id)
{
T entity = em.find(clazz, id);
em.refresh(entity);
return entity;
}
}
These methods are never called inside an existing transaction. The db is exclusively accessed by this application using only JPA and no trigger/stored procedure/other is defined.
My guess is they are equivalent, because:
Did I miss something?
Upvotes: 0
Views: 308