[appengine-java] Re: JPA query + missing the obvious?
A missing info -- the matching data is persisted before, in a separate/ different transaction. -- 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.
[appengine-java] Re: JPA query + missing the obvious?
Experimenting a bit more, I'm now even more confused ... Set set = new HashSet(); Query query = getEM().createQuery("select s from Subscription s where s.clientId = ?1"); Long cid = client.getId(); query.setParameter(1, cid); List list = query.getResultList(); // <-- not empty set.addAll(list); query = getEM().createQuery("select s from Subscription s where s.topicId = ?1"); Long tid = topic.getId(); query.setParameter(1, tid); list = query.getResultList(); // <-- same results as before -- as we have proper "intersection" data set.addAll(list); query = getEM().createQuery("select s from Subscription s where s.clientId = ?1 and s.topicId = ?2"); query.setParameter(1, cid); query.setParameter(2, tid); list = query.getResultList(); // <- no results?!? set.addAll(list); return getSingleResult(set); -- 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.
[appengine-java] Re: JPA query + missing the obvious?
Again, to answer things myself. This one looks like a bug in JPA query parameter setting, or I'm using it the wrong way -- what's the index start, 0 or 1? (I would expect if I set ?1, then I should use 1 as parameter index, right?) The query works correctly if you use named version of parameter setting. e.g. setParameter("some_id", id) vs. setParamter(1, id) -- 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.