Is there a way to determine the order of tables listed in the from clause in the generated SQL? In Oracle, the default behavior is for the driving table of a join to be listed last, and it should be the smallest table. What I'm seeing is that subclass tables are not being listed after the it's superclass.
For example, I have a class, Dog, which is a subclass of Animal. I'm mapping them using <joined-subclass>:
Code:
<class name="Animal" table="Animals">
<property name="legs" />
<joined-subclass name="Dog" table="Dogs">
<property name="breed" />
</joined-subclass>
</class>
I'm doing a simple query: from Dog as d where d.breed=?
The SQL that gets generated is: select * from Dog d, Animal a where d.id=a.id and d.breed=?, which in this case turns out to be horribly slow. I'd like to be able to flip the 2 tables in the from clause so that it reads: select * from Animal a, Dog d where a.id=d.id and d.breed=?.
Is this possible? Am I missing something?
I'm using Hibernat 2.1.6.
Thanks!
P/S - Is there anyway to work with the indexes?