Issued filed: http://code.google.com/p/datanucleus-appengine/issues/detail?id=185
On Fri, Jan 8, 2010 at 10:12 AM, Max Ross (Google) < [email protected] <maxr%[email protected]>> wrote: > I'm really sorry but I've been unable to construct an equivalent query that > avoids this bug. If the size of keyList isn't too large I'd recommend > executing a batch get to retrieve all those objects by id and then applying > the rest of your filter in-memory. > > Sorry for the trouble. > > Max > > > On Fri, Jan 8, 2010 at 9:48 AM, Max Ross (Google) < > [email protected] <maxr%[email protected]>> wrote: > >> Thanks for the report, looks like a bug. Multiple contains() clauses are >> fine but I didn't properly account for the case where one of the clauses is >> on the primary key of the object. The fix should be straightforward but let >> me see if I can get you a workaround. >> >> Max >> >> On Thu, Jan 7, 2010 at 7:06 PM, siliconeagle <[email protected]> wrote: >> >>> Basically i have 3 fields in the same table to select by >>> using .contains() clauses - one is the primary key field >>> >>> so :keyList (java.util.Set<Key>) , :feedTypes (java.util.Set<Integer>) >>> & :contentTypes(java.util.Set<Integer>) with values i need to select >>> with. >>> >>> The Feed object (and the relevant fields) is >>> @PersistenceCapable(identityType = IdentityType.APPLICATION) >>> public class Feed { >>> >>> @PrimaryKey >>> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) >>> private Key id; >>> ... >>> @Persistent >>> private int typeFeed ; >>> @Persistent >>> private int typeContent = CONTENT_TYPE_NOTCHECKED; >>> .... >>> } >>> >>> so i try this >>> Query query1 = pm.newQuery(Feed.class); >>> query1.setFilter(":keyList.contains(id) && :feedTypes.contains >>> (typeFeed) && :contentTypes.contains(typeContent)"); >>> query1.setRange(0,500); >>> Map<String, Collection> paramsf = new HashMap<String, Collection>(); >>> paramsf.put("keyList", feedIds); >>> paramsf.put("feedTypes", feedTypes); >>> paramsf.put("contentTypes", contentTypes); >>> feeds = (List<Feed>) query1.executeWithMap(paramsf); >>> >>> and i get >>> javax.jdo.JDOFatalUserException: Batch lookup by primary key is only >>> supported if no other filters and no sort orders are defined. >>> >>> Is there any way around it - from other posts it looks like subqueries >>> an the IN syntax arent supported. >>> >>> >>> >>> >>> -- >>> 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]<google-appengine-java%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/google-appengine-java?hl=en. >>> >>> >>> >>> >> >--
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.
