ArrayList 不想持久保存在 AppEngine HR 数据库上,如何修复?
我试图坚持和ArrayList,但它不起作用。一切 在本地很棒 [M/S db],但是当我部署它时 [HR] 那么对象就会 不坚持。有什么想法吗?这真的很奇怪,我找不到任何 解决方案。
我使用 JDO 与 DataNucleus 和 Guice 进行注入,这里是必需的代码:
@Persistent(defaultFetchGroup = "true", serialized="true")
private ArrayList<ArrayList<Long>> colonisations = new
ArrayList<ArrayList<Long>>();
在 User 类
另一个类,尝试保存数据:
@Inject
public Repository<User> userRepo;
...
...
MySession.get().getUser().getColonisations().add(colonisation);
...
...
Colonisation.this.userRepo.persist(MySession.get().getUser());
我从日志中得到的唯一提示是:
org.datanucleus.ObjectManagerImpl close:杰出的 nontx 更新 致力于数据存储
I am trying to persist and ArrayList, but it does not work. Everything
is great locally [M/S db], but when I deploy it [HR] then objects do
not persist. Any ideas why? It's really weird and I cannot find any
solution.
I use JDO with DataNucleus and Guice for injections, here is required code:
@Persistent(defaultFetchGroup = "true", serialized="true")
private ArrayList<ArrayList<Long>> colonisations = new
ArrayList<ArrayList<Long>>();
at User class
Another class, that tries to persist the data:
@Inject
public Repository<User> userRepo;
...
...
MySession.get().getUser().getColonisations().add(colonisation);
...
...
Colonisation.this.userRepo.persist(MySession.get().getUser());
The only hint I am getting from logs is:
org.datanucleus.ObjectManagerImpl close: Outstanding nontx update
being committed to datastore
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你在持久化的时候使用currentTransaction吗?
我希望我有更多关于此的信息,但我遇到了类似的问题,同时在 GAE 中使用 JDO 从 datanucleus 中进行持久化和检索,并且我发现在使用时
我没有再遇到任何问题。
我希望我有所帮助。
Do you use the currentTransaction while persisting?
I wish I had more info about this, but I had a similar problem, while persisting and retrieving from datanucleus using JDO in GAE, and I figured out that while I was using
I didn't have any more problems.
I hope I 've helped a bit.
将字段弄脏可以解决问题,因此 DataNucleus 会看到它已被更改。
Making the field dirty solves the issue, so DataNucleus sees that it's been changed.