I want my loads to perform joins instead of selects. I have read the documentation and have tried to configure my classes to load using joins, but the logs show they are using selects.
VesselStack has an ISet of VesselSpot
VesselSpot has an ISet of VesselTelemetry
When performing a load of VesselStack I see multiple selects in the logs instead of one select with outer joins.
Any suggestions on why this is not working?
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="connection.connection_string">User ID=Foo;Password=Bar;Data Source=fooBar</property>
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="max_fetch_depth">4</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Server"
namespace="Model"
default-cascade="save-update">
<class name="VesselStack" table="VESSEL_STACK" dynamic-update="true">
<id name="VesselStackId" column="VESSEL_STACK_ID">
<generator class="uuid.hex" />
</id>
<property name="BayIso" column="BAY_ISO"/>
<property name="StackIso" column="STACK_ISO"/>
<set name="VesselSpots" table="VESSEL_SPOT" inverse="true" cascade="all" fetch="join" lazy="false" sort="VesselSpotComparer">
<key column="VESSEL_STACK_ID" />
<one-to-many class="VesselSpot" />
</set>
</class>
<class name="VesselSpot" table="VESSEL_SPOT" dynamic-update="true">
<id name="VesselSpotId" column="VESSEL_SPOT_ID">
<generator class="uuid.hex" />
</id>
<property name="SpotIso" column="SPOT_ISO"/>
<set name="VesselTelemetries" table="VESSEL_TELEMETRY" inverse="true" cascade="all" fetch="join" lazy="false" sort="VesselTelemetryComparer">
<key column="VESSEL_SPOT_ID" />
<one-to-many class="VesselTelemetry"/>
</set>
<many-to-one name="VesselStack" class="VesselStack" column="VESSEL_STACK_ID" cascade="save-update" fetch="join" lazy="false" not-null="true"/>
</class>
<class name="VesselTelemetry" table="VESSEL_TELEMETRY" dynamic-update="true">
<id name="VesselTelemetryId" column="VESSEL_TELEMETRY_ID">
<generator class="uuid.hex" />
</id>
<property name="ResultBayIso" column="RESULT_BAY_ISO"/>
<property name="ResultStackIso" column="RESULT_STACK_ISO"/>
<property name="ResultTierIso" column="RESULT_TIER_ISO"/>
<many-to-one name="VesselSpot" class="VesselSpot" column="VESSEL_SPOT_ID" cascade="save-update" fetch="join" lazy="false" not-null="true"/>
</class>
</hibernate-mapping>