Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.1
Name and version of the database you are using:
I have 5 tables one parent table A, children tables: B, C, D, E. I used discreminator in the class A to distingusih the actual type of the data (child B, C, D or E). However, when I make a hql query, I found there are 4 sql generated every row I retrieved.
For example:
hql:
from A as a where A.type = 'B'
sql gerneated:
select * top 20 from A a, B b where (a.id=b.id )
select * from B where b.id = ?
select * from C where c.id = ?
select * from D where d.id = ?
select * from E where e.id = ?
As above example, there will be 80 sql generated to retrieve 20 recrods.
The performance of the query is extremely bad and I would like to know if it is possible in hibernate to execute 1 sql to the database to map to multiple rows?
Thanks a lot!