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 :(
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.