不能让一个LazyForeignCollection成为渴望集合 [英] Cannot make a LazyForeignCollection become eager collection
问题描述
我想从我的POJO
读外国集合时得到这个错误 AndroidRuntime(589):java.lang.IllegalStateException:通过内部造成DAO
对象为null。如果它们已被反序列化,不能使用懒惰集合。
有问题的集合是 answers1
我已标记为渴望
@ForeignCollectionField(渴望= TRUE)
私人ForeignCollection< TextAnswer> answers1;
那么,为什么当我调试低于
方法 公开名单< TextAnswer> getAnswers(){
返回新的ArrayList< TextAnswer>(answers1);
}
这是它告诉我的集合是一个LazyForeignCollection?我很疑惑。
我有这个概率没有任何我使用ForeignCollections其他类:(
如果它们已被反序列化懒惰集合不能使用。
块引用>有趣的问题。首先,该消息是的只有的在
LazyForeignCollection
类。有没有在ANSWER1
字段的使用的偷懒,连载的机会呢?被序列化参与呢?里面的DAO
字段ForeignCollection
不应该空
除非对象已系列化。我现在的假设是,你反序列化类的previous版本。如果不是这种情况,那么我也没办法。
I'm getting this error when trying to read a foreign collection from my POJO
AndroidRuntime(589): Caused by: java.lang.IllegalStateException: Internal DAO object is null. Lazy collections cannot be used if they have been deserialized.
The offending collection is
answers1
which i have marked as 'eager'@ForeignCollectionField (eager=true) private ForeignCollection<TextAnswer> answers1;
Why then when I debug the method below
public List<TextAnswer> getAnswers() { return new ArrayList<TextAnswer>(answers1); }
That it tells me the collection is a LazyForeignCollection? I am puzzled.
I have no prob with this in any of my other classes that use ForeignCollections :(
解决方案Lazy collections cannot be used if they have been deserialized.
Interesting problem. First off, that message is only in the
LazyForeignCollection
class. Is there any chance that theanswer1
field used to be lazy and was serialized? Is serialization involved at all? Thedao
field inside of aForeignCollection
should never benull
unless the object has been serialized.My assumption right now is that you are deserializing a previous version of the class. If this is not the case then I have no idea.
这篇关于不能让一个LazyForeignCollection成为渴望集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!