i have a HQL query like this one :
Select foo
From Foo foo, Bar bar
Where foo.number = bar.number
but it takes hibernate 4, 5 seconds to execute because the two tables are very big ones. and i did a tracing with Hibernate stat and trace log and found that this HQL query execute 500 Select! that why it takes lot of time because i have 3 manyToOne in the first table and 7 ManyToOne & OneToMany in the other one. is there a way to optimize this HQL query without using or converting it to SQL query?
in case of using native SQL query, i need to remap the results from objects to a foo entity object witch i don't prefer.