I have a OneToMany relationship between two entities and when invoking a method on the lazy loaded Parent object after calling getParent() from the Child, Hibernate (3.5.6GA) invokes a huge polymorphic query with all the left outer joins. The Parent does have over 30 different entity types in my system, so this makes sense that Hibernate needs the query to determine the type. However, I do have a discriminator column but Hibernate doesn't seem to be able to take advantage of that in order to make the query more efficient.
What can I do to improve this query? The thing is, in this case, I know the Parent can only be one of a few different types. Is there something I can extend (one of the Tuplizer classes?) to put in a little logic to simplify the query?
Thanks!
|