One way to do this would be to duplicate A.name on the associated Bs.
class A {
Long id;
String name;
...
}
class B {
Long id;
Long Aid;
Long Aname;
...
}
Then you'd be able to do your select on just the B entity group and it
would work.
On Mar 10, 2:59 am, kattus <[email protected]> wrote:
> Hi,
>
> I have 2 persistent classes:
>
> 1. class A that has a primary key (Long) and a property called
> "name" (String).
> 2. class B that is referencing class A (one to many relationship, each
> B has one A, but A can belong to many B's)
>
> I need to retrieve the B's sorted by the "name" property of A. In
> other words if it was relational database I would make something like
> this (simplified):
>
> SELECT * FROM A, B WHERE A.id=B.Aid ORDER BY A.name
>
> The question is how to make this with JDO. I don't want to make A and
> B in the same entity group and it seams it is not necessary either, I
> think using unowned relationships may be a good direction, the help is
> too basic though:
>
> http://code.google.com/appengine/docs/java/datastore/relationships.ht...
>
> The questions are:
>
> Is it possible to define such a relationship between A and B? If yes
> how (which annotations)? Do I have to use the Key class in B to
> reference A?
> How to use the Google query language to write the correct query?
>
> Thank you,
> Gil
--
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.