[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Need help with a query where an entity has a list of other entities
|
Hi eclipselink-list,
i need a help with a difficult query, well for me it's difficult :)
I have an entity A which contains a list of entities of type B
(List<B>) and B contains in turn a list of entities of type C
(List<C>). Now I want to build a query where I can do the following:
Select A where their List<B> contains an entry with the name "Foo" and
in turn this entry with the name "Foo" has C's which has the value
"Bar".
For a better understanding some pseudo code:
<snip>
class A {
List<B> listB;
}
class B {
String name;
List<C> listC;
}
class C {
String value;
}
</snap>
I guess in pure SQL i would write it like this: select * from A, B, C
where A.id = B.a_id AND B.name = 'Foo' AND B.id = C.b_id AND C.value =
'bar';
I think i could be able to write a pure SQL-Statement but I don't want
to do that if there is a much more better and easier solution using
eclipselink (and its maybe not database independent).
Hope someone can help me. Thanks in advance!
-- Christian