Can you post the queries you have attempted as well as the errors?

On Tue, Nov 10, 2009 at 10:40 PM, enthusiast <itzraj...@gmail.com> wrote:

>
> I have a very basic question about JDOQL with GAE/J. Hope someone can
> shine light on this:
>
> I have modeled two persistent objects Employee and ContactInfo such
> that Employee contains an instance of ContactInfo, as follows:
>
> ContactInfo.java
>
> import com.google.appengine.api.datastore.Key;
> // ... imports ...
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class ContactInfo {
>    @PrimaryKey
>    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>    private Key key;
>
>    @Persistent
>    private String city;
>
>    // ...
> }
>
>
> Employee.java
>
> import ContactInfo;
> // ... imports ...
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class Employee {
>    @PrimaryKey
>    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>    private Key key;
>
>    @Persistent
>    private Integer salary;
>
>    @Persistent
>    private ContactInfo contactInfo;
>
>    Integer getSalary() {
>        return salary;
>    }
>
>    void setSalary(Integer salary) {
>        this.salary = salary;
>    }
>
>    ContactInfo getContactInfo() {
>        return contactInfo;
>    }
>
>    void setContactInfo(ContactInfo contactInfo) {
>        this.contactInfo = contactInfo;
>    }
>
>    // ...
> }
>
> I am able to create instances of Employee with relevant ContactInfo
> objects. However, I am not able to query for Employee which uses a
> field on the ContactInfo object. E.g. If I want to retrieve only those
> employees whose salary > 10000 AND ContactInfo.city == "New York", how
> do I construct such a query?
>
> If I just want to query on the field in the Employee object, I get the
> results, but when I use a field in the sub-object of Employee (i.e.
> ContactInfo) I get an error.
>
> Any help???
> --~--~---------~--~----~------------~-------~--~----~
> 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.com<google-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

--

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


Reply via email to