Beginner |
|
Joined: Mon Jan 31, 2005 11:04 am Posts: 21
|
Suppose we have the following hierarchical model:
class Person {
public void initDependencies() {
}
}
class Notary extends Person {
@Fetch(SUBSELECT)
Set functions=new HashSet();
public void initDependencies() {
this.functions.size();
}
[...]
// getter and setter
}
When performing a polymorphic search on Person (sub classes Notary elements will also be gotten from DB) like the HQL:
String hql = "from Person p where name like 'smi%'"
If i want to initialize the functions of the Notary, I do the following:
Query query = session.createQuery(hql);
List<Person> results = query.list();
for(Person person:results) {
person.initDependencies();
}
This works fine but I would expect that a subselect query is run to fetch the functions of all the selected Notary (Person). Instead I got one single select request for each Notary (Person) :-(
It seems that a polymorphic query doesn't apply the Fetching startegy configured on the model?
Bruno
|
|