-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Fetching strategy not working on polymorphic query
PostPosted: Thu Aug 21, 2008 7:58 am 
Beginner
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.