I have table A (customer) and table B (customerExtras) with a one-on-one relationship. In the mapping file of table A there is following entry:
Code:
<many-to-one name="customerExtras" lazy="false" not-found="ignore" cascade="none" class="CustomerExtras" insert="false" update="false">
<column name="bp_cd" />
<column name="bp_ods_cd"/>
<column name="cust_nb"/>
</many-to-one>
I use the criteria API to search table A:
Code:
Criteria crit = sess.createCriteria(Customer.class)
.setFetchMode("customerExtras", FetchMode.JOIN)
.createAlias("customerExtras", "customerExtras")
...
The statement works fine but for every entry in table A which has no entry in table B a separated select-statement is send to the database. Can someone please explain me the reason for that behaviour and how I can turn it off?