为什么我需要使用一个事务来坚持一个实体?有什么我可以添加到我的persistence.xml自动提交?如何在JPA中自动提交SQL Server事务?
这不插入:
em.persist(this);
但这:
em.getTransaction().begin();
em.persist(this);
em.getTransaction().commit();
我想我最初的基准点是this GWT doco
public void persist()
{
EntityManager em = entityManager();
try
{
em.persist(this);
}
finally
{
em.close();
}
}
[链接](https://developers.google.com/web- toolkit/doc/latest/DevGuideRequestFactory)有一个不使用事务的例子...你为什么这么想? – upshake
那是什么? Google AppEngine使用DataNucleus JPA,即提供自动提交模式的JPA实现(如我已经说过的) – DataNucleus
非常好。谢谢。 – upshake