>         EntityManager em = EMF.get().createEntityManager();
>         PrintWriter out = response.getWriter();
>
>         List<Dog> dogs;
>
>         try {
>
>             Query query = em.createQuery("SELECT FROM Dog WHERE
> dogFriends = :key");
>             query.setParameter("key", key);
>             dogs = (List<Dog>) query.getResultList();
>
>             dogs.size();  // Do this so we can eager load the list and

solve it!

running your code in my unit test i still get a 0 size result list.

*until* i added the following in my unittest

Dog user1 = new Dog()

//blah blah
em.merge(user1);

em.close();  <-- needed to close existing em

em = getEnityManager();

//query now executes correctly


it seems that the entity manager is not working as i expected.
by doing em.close after making objects persistent and then getting new
em, allowed the em.query to execute correctly.

i am not clear of why the em behaviours like that, given the em.find()
seem to find the correct object.

any ideas?

-lp

--

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-j...@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