Sorry for all the posts, but wow...so many restrictions.

So it also seems like this only works if there is no subclassing.
meaning that if you are quering on a class whose parent property is in
its super class, then this does not work and throws and null pointer
exception.  This just looks wrong doesn't it?

Person is a subclass of User and company is defined in the User class
not in Person (Even though User has an inhertance strategy of
SUBCLASS_TABLE).  That started to give me a null pointer exception
until I refactored and moved that property down to the Person class.

Grrrrr.


On Apr 30, 4:57 pm, korey_sed <[email protected]> wrote:
> Looks like I had this wrong the first time.
>
> Change:
> q.declareVariables(Company.class.getName() + " companyParam");
> To:
> q.declareParameters(Company.class.getName() + " companyParam");
>
> Its happier this way.
>
> On Apr 29, 2:15 pm, korey_sed <[email protected]> wrote:
>
>
>
> > I struggled with this for a while and could not find a clear example,
> > so I hope it helps someone out there.
>
> > I have a company object that has employees and employees could be
> > deleted (boolean property).  So I wanted to search for all employees
> > for company X where the company is not deleted.  It should be noted
> > that I have a bidrectional owned relationship setup between Company
> > and Person.
>
> > here is how I did it in JDO:
>
> > <code>
> > Key companyKey = KeyFactory.stringToKey(companyKeyString);
> > String queryStr = "select from " + Person.class.getName() +
> >                         " where company == companyParam && deleted == 
> > false";
> > Query q = pm.newQuery(queryStr);
> > q.declareVariables(Company.class.getName() + " companyParam");
> > persons = (List<Person>)q.execute(companyKey);
> > </code>
>
> > --
> > 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 
> > athttp://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 
> athttp://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.

Reply via email to