[appengine-java] Re: Unsupported method contains while parsing expression:

2012-03-14 Thread James M
Hey Google,

If that really is a mistake in the documentation that Ftaylor pointed out, 
can you take the 5 minutes and update it?  That 5 minutes sure would pay 
lots of dividends on the other side in terms of saved minutes trying to 
figure out why things aren't working.

The documentation is posted here:  
http://code.google.com/appengine/docs/java/datastore/jdo/queries.html#Introducing_Queries

In the Query Filters section, the example shown contradicts the JDO spec 
according to Andy's response. 

Now, if the documentation is correct, then I'm just confused, and I'll just 
crawl back into my computer screen and continue beating my head against 
this stuff until it makes sense. However, if it's not correct, can we get 
someone to update that please? It's been 3 years now. :)

Thanks,
James

On Thursday, January 28, 2010 4:45:26 AM UTC-8, Ftaylor wrote:

 Code:

 Class Page {

 ListString aliases;

 ...

 query = pm.newQuery(Page.class);
 query.setFilter(:aliases.contains(alias));
 query.declareVariables(String alias);
 ListPage results = (ListPage)query.execute(alias);

 ...

 }

 I want to select Page objects where the aliases property contains a
 given alias String value. Is there any way to do this? I tried as
 above and got an exception:

 Problem with query SELECT FROM getimgs.Page WHERE :aliases.contains
 (alias) VARIABLES String alias: Unsupported method contains while
 parsing expression: InvokeExpression{[ParameterExpression
 {aliases}].contains(VariableExpression{alias})}

 If this cannot be done with JDOQL, the only solution I can think of is
 selecting every Page object, then looping through them and using
 Java's contains method, but this sucks somewhat.

 Anyone?

 Cheers,

 Finbarr



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/XQkJadTLIg4J.
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.



[appengine-java] Re: Unsupported method contains while parsing expression:

2012-03-14 Thread James M
Sorry, it was 2 years ago.  I added wrong :)

James

On Wednesday, February 3, 2010 9:40:27 AM UTC-8, Ftaylor wrote:

 There actually seems to be a mistake in the documentation:

  // Give me all Employees with lastName equal to Smith or Jones
 Query query = pm.newQuery(Employee.class,
   :p.contains(lastName));
 query.execute(Arrays.asList(Smith, Jones));

 Surely it should be:

  // Give me all Employees with lastName equal to Smith or Jones
 Query query = pm.newQuery(Employee.class,
   p.contains(:lastName));
 query.execute(Arrays.asList(Smith, Jones));


 On Feb 2, 10:29 pm, Ikai L (Google) ika...@google.com wrote:
  Oy, this is what I get for not running code before posting it. Good 
 looking
  out.
 
  On Tue, Feb 2, 2010 at 1:06 AM, datanucleus andy_jeffer...@yahoo.com
 wrote:
 
 
 
 
 
   query.setFilter(aliases == alias);
 
   That is invalid JDOQL syntax; the spec is the spec and JDOQL uses Java
   syntax.
   If you have a collection field then the filter should be
 
   aliases.contains(:alias)
 
   The poster put the colon in front of a field name (wrong), and
   declared a parameter as a variable (wrong).
 
   --
   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.comgoogle-appengine-java%2B

 unsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/google-appengine-java?hl=en.
 
  --
  Ikai Lan
  Developer Programs Engineer, Google App Enginehttp://
 googleappengine.blogspot.com|http://twitter.com/app_engine



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/k-5OJNQMQmUJ.
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.



[appengine-java] Re: Unsupported method contains while parsing expression:

2010-02-03 Thread Ftaylor
There actually seems to be a mistake in the documentation:

 // Give me all Employees with lastName equal to Smith or Jones
Query query = pm.newQuery(Employee.class,
  :p.contains(lastName));
query.execute(Arrays.asList(Smith, Jones));

Surely it should be:

 // Give me all Employees with lastName equal to Smith or Jones
Query query = pm.newQuery(Employee.class,
  p.contains(:lastName));
query.execute(Arrays.asList(Smith, Jones));


On Feb 2, 10:29 pm, Ikai L (Google) ika...@google.com wrote:
 Oy, this is what I get for not running code before posting it. Good looking
 out.

 On Tue, Feb 2, 2010 at 1:06 AM, datanucleus andy_jeffer...@yahoo.comwrote:





      query.setFilter(aliases == alias);

  That is invalid JDOQL syntax; the spec is the spec and JDOQL uses Java
  syntax.
  If you have a collection field then the filter should be

  aliases.contains(:alias)

  The poster put the colon in front of a field name (wrong), and
  declared a parameter as a variable (wrong).

  --
  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.comgoogle-appengine-java%2B 
  unsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

 --
 Ikai Lan
 Developer Programs Engineer, Google App 
 Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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: Unsupported method contains while parsing expression:

2010-02-03 Thread Ftaylor
Wow that mistake in the documentation wasted days of my time. Thankyou
datanucleus.

On Feb 3, 5:40 pm, Ftaylor finbarrtay...@googlemail.com wrote:
 There actually seems to be a mistake in the documentation:

  // Give me all Employees with lastName equal to Smith or Jones

     Query query = pm.newQuery(Employee.class,
                               :p.contains(lastName));
     query.execute(Arrays.asList(Smith, Jones));

 Surely it should be:

  // Give me all Employees with lastName equal to Smith or Jones

     Query query = pm.newQuery(Employee.class,
                               p.contains(:lastName));
     query.execute(Arrays.asList(Smith, Jones));

 On Feb 2, 10:29 pm, Ikai L (Google) ika...@google.com wrote:



  Oy, this is what I get for not running code before posting it. Good looking
  out.

  On Tue, Feb 2, 2010 at 1:06 AM, datanucleus andy_jeffer...@yahoo.comwrote:

   query.setFilter(aliases == alias);

   That is invalid JDOQL syntax; the spec is the spec and JDOQL uses Java
   syntax.
   If you have a collection field then the filter should be

   aliases.contains(:alias)

   The poster put the colon in front of a field name (wrong), and
   declared a parameter as a variable (wrong).

   --
   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.comgoogle-appengine-java%2B
unsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/google-appengine-java?hl=en.

  --
  Ikai Lan
  Developer Programs Engineer, Google App 
  Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

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



Re: [appengine-java] Re: Unsupported method contains while parsing expression:

2010-02-02 Thread Ikai L (Google)
Oy, this is what I get for not running code before posting it. Good looking
out.

On Tue, Feb 2, 2010 at 1:06 AM, datanucleus andy_jeffer...@yahoo.comwrote:

 query.setFilter(aliases == alias);

 That is invalid JDOQL syntax; the spec is the spec and JDOQL uses Java
 syntax.
 If you have a collection field then the filter should be

 aliases.contains(:alias)

 The poster put the colon in front of a field name (wrong), and
 declared a parameter as a variable (wrong).

 --
 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

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