I have an entity with a List<String> in it as follows:

        @OneToOne(fetch = FetchType.LAZY)
        @Embedded
        public Set<String> getWords()
        {
                return words;
        }

        public void setWords(Set<String> words)
        {
                this.words = words;
        }

If I set FetchType to "LAZY" in my code, compile, and then execute a
finder on this entity, then try to access the "words" collection on
the returned object, I get the following exception:

"javax.jdo.JDODetachedFieldAccessException: You have just attempted to
access property "words" yet this property was not detached when you
detached the object. Either dont access this property, or detach it
when detaching the object."

However, if I set the FetchType to Eager, I can access the "words"
field.  This seems odd to me, since everything I'm reading in the docs
and in this group seems to indicate that EAGER fetching requires
joins, and joins are not supported.

Should I be using LAZY here, or EAGER?

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to