W
wls
I've got a one-to-many association between two entities, X and Y.
class X {
@OneToMany( cascade = CascadeType.ALL )
private List<Y> collection = new ArrayList<Y>();
}
What's the HSQL notation to return any X who's collection contains a Y
with a specific property?
In SQL, I'd do a join between X and Y where Y.whatever = value.
However, I think I'm using the wrong terminology, as I can't seem to
find an example in the Hibernate Reference Documentation (version
3.2.5).
So, I backed off and tried just finding if a thing was in a
collection, using:
List<X> found = session.createQuery( "from X x where :y in
( x.collection )" ).setEntity( "y", y ).list();
Naturally this gives me syntax error.
Can anyone point me in the right direction?
Thanks in advance,
-Walt Stoneburner, (e-mail address removed)
http://www.wwco.com/~wls/
class X {
@OneToMany( cascade = CascadeType.ALL )
private List<Y> collection = new ArrayList<Y>();
}
What's the HSQL notation to return any X who's collection contains a Y
with a specific property?
In SQL, I'd do a join between X and Y where Y.whatever = value.
However, I think I'm using the wrong terminology, as I can't seem to
find an example in the Hibernate Reference Documentation (version
3.2.5).
So, I backed off and tried just finding if a thing was in a
collection, using:
List<X> found = session.createQuery( "from X x where :y in
( x.collection )" ).setEntity( "y", y ).list();
Naturally this gives me syntax error.
Can anyone point me in the right direction?
Thanks in advance,
-Walt Stoneburner, (e-mail address removed)
http://www.wwco.com/~wls/