Yea, I actually figured it out yesterday. I am using dynamic queries
and that seems to be the only solution as of now from my side. Thanks
for your time though.


public  List<College> getEntriesOnSearch(String location, String
btech) {

StringBuffer selectClause = new StringBuffer("select from
com.strutsgoogle.CollegeApp.College ");
StringBuffer whereClause= new StringBuffer("");
boolean flag = false;

  if(!("".equals(btech))){
  flag = true;
  whereClause.append(" btech == '"+btech+"' ");
  }

  if(!("".equals(location))){
  if(flag) {
  whereClause.append(" && ");
  }
 flag = true;
 whereClause.append(" location == '"+location+"' ");
  }

String whereClauseString = whereClause.toString();
   if(!("".equals(whereClauseString))){
  selectClause.append(" where ");
  }

 String queryString = selectClause.append(whereClause).toString();
 System.out.println("queryString "+queryString);
 Query query = pm.newQuery(queryString);
 List <College>entries = (List<College>) query.execute();
 query.closeAll ();
 return entries;
 }


On Mar 24, 5:41 am, Torquester <[email protected]> wrote:
> I think you have to use two queries and merge the results afterwards
> in your code. As you said, datastore does not allow you to use
> inequality filters and logical "or" operators on more than one
> property. I guess from a performance perspective this doesn't make
> much difference. Appengine would have to translate the statement into
> separate queries anyway.
>
> Cheers, Chris
>
> On Mar 23, 8:09 am, Amaan <[email protected]> wrote:
>
>
>
> > I have a class College declared with location and fName String fields.
> > I am trying to retrieve values from that table using the following
> > query. On execution it says that SQL construct is not supported by the
> > JDO in googe app engine.
>
> > Query query = pm.newQuery("javax.jdo.query.SQL", "select * from
> > College where location like '"+xxxx+"' or fName like '"+yyyy+"'");
> >  query.setClass(College.class);
> >  College results = (College)query.execute();
>
> > How can i solve this problem? If i try to use
>
> > Query query = pm.newQuery("select from
> > com.strutsgoogle.CollegeApp.College where location == '"+ location+"'
> > && fName=='amaan'");
> >   List <College>entries = (List<College>) query.execute();
>
> > This result set would only return me results based on the condition if
> > both the criterias location and fName are true. how can i get somethg
> > in which i may not pass any value for the fName parameter and still
> > get results for all the locations. || operator can be applied to the
> > same field from the table and not multiple fields.
>
> > SQL query: select * from college where location like 'xxxx.' or fName
> > like 'yyyy'
> > Can somebody help me in getting the JDOQuery supported by google app
> > engine for the above mentioned SQL query construct??- Hide quoted text -
>
> - Show quoted text -

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

Reply via email to