在不关闭Persistence Manager的情况下写入数据存储区

时间:2015-03-29 07:51:14

标签: java google-cloud-datastore jdo persistence-manager

如何在不关闭对象的情况下使用PersistenceManager更新对象时提交数据库?

1 个答案:

答案 0 :(得分:1)

您需要提交交易。您无需关闭PersistenceManager。

PersistenceManager p;
...
p.currentTransaction().begin();
.... //do the work
p.currentTransaction().commit();