JDO is a thin layer which gives you some kind of automation and
restriction.
But it exists only an run time. I mean you have to instantiate objects
first. In other words
Company c = getCompany();
for(Person p:c.getPersons()){
if(p.isDeleted())
continue;
//do what ever you want to do
}
On Apr 29, 1: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 at
http://groups.google.com/group/google-appengine-java?hl=en.