持久性错误

发布于 2024-12-27 07:23:26 字数 632 浏览 2 评论 0原文

我有一堂课:

@PersistenceCapable
public class X{
    @Persistent
    @Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "date desc"))
    private List<Race> list;

    @Persistent
    private Float value;
}

当我尝试制作时:

PersistenceManager pm = PMF.get().getPersistenceManager();
try {
    X x = pm.getObjectById(X.class, id);
    x.setValue(listObject.getValue().floatValue());
    x.getList().add(listObject);
} finally {
    pm.close();
}

我期望在我的 X 对象中添加一个 listValue 并设置“value”的值。但结果只是将列表中的值相加,忽略了ghe值的设置!

有什么问题吗?

I have a class:

@PersistenceCapable
public class X{
    @Persistent
    @Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "date desc"))
    private List<Race> list;

    @Persistent
    private Float value;
}

When I try to make:

PersistenceManager pm = PMF.get().getPersistenceManager();
try {
    X x = pm.getObjectById(X.class, id);
    x.setValue(listObject.getValue().floatValue());
    x.getList().add(listObject);
} finally {
    pm.close();
}

I'm expecting that in my X object I will add a listValue and set the value of 'value'. But the result is only adding the value in the list, ignoring the setting of ghe value!

Is there anything wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心欲静而疯不止 2025-01-03 07:23:26

这是一个并发错误。

从更改同一对象的另一段代码调用此方法。所以这个调用的变化将会被忽略。

It was a concurrency error.

This method is called from another piece of code that changes the same object. So the changes of this call will be ignored.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文