ORMLite对外收集和序列化

发布于 2024-12-11 04:06:54 字数 456 浏览 0 评论 0原文

如何使用 ORMLite ForeignCollection 在两个活动之间发送对象? ForeignCollection 是不可序列化的吗?我收到 IOException ,这是由于不可序列化对象造成的。

例如:在

@ForeignCollectionField(eager = false)
private transient ForeignCollection<CallObjective> _callObjectives;

My CallObjective 类中的 My Call 类中:

@DatabaseField(columnName = "CallId", foreign = true, foreignAutoRefresh = true)
private Call _call;

How to send an object with ORMLite ForeignCollection between two activities ? Is that ForeignCollection is non serializable ? I'm getting the IOException which is due to non serializable object.

Ex: in My Call class

@ForeignCollectionField(eager = false)
private transient ForeignCollection<CallObjective> _callObjectives;

in My CallObjective class:

@DatabaseField(columnName = "CallId", foreign = true, foreignAutoRefresh = true)
private Call _call;

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

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

发布评论

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

评论(1

ぽ尐不点ル 2024-12-18 04:06:54

ORMLite 版本 4.26 中,我们对 EagerForeignCollection 类进行了一些改进,使其更加可序列化。前几天我在主干中发现了一个错误,实际上[不幸的是]阻止了您与 eager = false 一起使用的 LazyForeignCollection 类的序列化。这将在 4.28 版本中修复。

即使集合是可序列化的,您也无法对惰性集合执行任何操作,因为上下文太多,无法正确反序列化它。它将是一个在大多数操作上抛出异常的 shell。

In version 4.26 of ORMLite we made some improvements to the EagerForeignCollection class to make it more serializable. I found a bug in trunk the other day actually that [unfortunately] stops the LazyForeignCollection class which you are using with the eager = false from being serializable. That will be fixed in version 4.28.

Even if the collection was serializable, you would not be able to do anything with the lazy collections because there is too much context to be able to deserialize it properly. It will be a shell that throws exceptions on most operations.

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