I've recently started working with JPA on the Google App Engine. In reading some examples, I've noticed a couple of variations in the way objects are persisted. In one case, I've seen something like this:
entityManager.getTransaction().begin();
entityManager.persist(object);
entityManager.getTransaction().commit();
In other cases, I don't see the use of getTransaction()
. I simply see entityManager.persist(object)
. When is it appropriate to use getTransaction()
?