Andy, first of all thx for the response. Things begin to make a little
more sense.

But still how do I solve my specific issue then. Is the solution to
access the retweets field within the JPA callback in this case (as
outside it counts as a 'commit'  ??

This is the groovy / grails code used in this case. I could try to
access the retweets at XXX and then save the result in another,
transient field... but this is really ugly.

        def tweetInstanceList =[]
38              jpaTemplate.execute( { entityManager ->
39                      def query = entityManager.createQuery("select tweet
from org.groovytweets.Tweet tweet order by tweet.statusId desc")
40                      query.maxResults = 50
41                      tweetInstanceList = query.resultList
XXX
42                  } as JpaCallback )


---

So detaching retweets seems like the best. But how? If you are saying
JPA1 does not allow this, it means there is no way for me to make this
nice?

Cheers
Sven

On Fri, Sep 11, 2009 at 12:43 PM, datanucleus <andy_jeffer...@yahoo.com> wrote:
>
>> I am not sure what you mean. I never detach anything explicitly, so I
>> have no idea how to detach anything else.
>
> Yes you do ... in JPA at commit or at close of the EntityManager the
> contract is to detach all current entities, as per the JPA spec. As
> you identified later in your post.
>
>> >javax.jdo.JDODetachedFieldAccessException: You have just attempted to
>> access field "retweets" yet this field was not detached when you
>> detached the object. Either dont access this field, or detach it when
>> detaching the object.
>>
>> I find that very strange.
>> 1. I am using JPA, how do I get a JDO exception?
>
> Because the JPA spec doesn't define the behaviour of accessing an
> undetached field of a detached object so we can throw whatever we
> want. We could throw something DataNucleus specific but then what's
> the point ? In some implementations they do nothing and return null,
> so the user has no real expectation here. Symptoms of a poor spec ...
>
>
> JPA2 will provide a detach method, when the spec is final ...
>
> --Andy (DataNucleus)
> >
>



-- 
Sven Haiges
sven.hai...@googlemail.com

Yahoo Messenger / Skype: hansamann
Personal Homepage, Wiki & Blog: http://www.svenhaiges.de

Subscribe to the Grails Podcast:
http://www.grailspodcast.com

--~--~---------~--~----~------------~-------~--~----~
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 google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to