Hallo -- my question is based upon the following example classes:
First, the class
MyClass:
Code:
public class MyClass{
private Long id;
private Set<MyOtherClass> myOtherClasses;
public Long getId(){return id;}
protected Long setId(Long id){this.id=id;}
public Set<MyOtherClass> getMyOtherClasses(){
return myOtherClasses;
}
public void setMyOtherClasses(Set<MyOtherClass> myOtherClasses){
this.myOtherClasses=myOtherClasses;
}
}
And also the class in the collection,
MyOtherClass:
Code:
public class MyOtherClass{
private Long id;
private String value;
public Long getId(){return id;}
protected Long setId(Long id){this.id=id;}
public String getValue(){return value;}
public void setValue(String value){this.value=value;}
}
Having established that, my question is -- would it be possible to construct an HQL query that returned instances of MyClass whose collections myOtherClasses contained one or more instances of MyOtherClass whose value attribute was equal to "Hello."?
In (bad) pseudo-code, this might be:
Code:
SELECT from MyClass c WHERE c.myOtherClasses CONTAINS MyOtherClass.value=="Hello."
Sorry -- I know that's a terrible attempt to express it -- that's why I ask for help!
Cheers,
doug.