Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.5
Mapping documents:
<class name="com.dcs.mcass.domain.Application" table="MCASS.APPLICATION">
<id name="contractId" column="I_CONTRACT_ID" type="long">
<generator class="foreign">
<param name="property">contract</param>
</generator>
</id>
...
<many-to-one name="dealer" class="com.dcs.mcass.domain.Dealer" column="C_DEALER_ID" insert="false" update="false" not-found="ignore"/>
/>
Code between sessionFactory.openSession() and session.close():
The following hql executes an outer join for dealer as expected but still does a separate select for it as well.
select a from Application a
left join fetch a.dealer d
Full stack trace of any exception that occurs:
Name and version of the database you are using: UDB 8.0.2
The generated SQL (show_sql=true):
select ... from MCASS.APPLICATION applicatio0_
left outer join MCASS.DEALER dealer3_ on applicatio0_.C_DEALER_ID=dealer3_.C_DEALER_ID
// still getting n+1 select
select ... from MCASS.DEALER dealer0_ where dealer0_.C_DEALER_ID=?
Debug level Hibernate log excerpt: