I have these 2 mappings:
<hibernate-mapping>
<class name="sample.Operator" table="OPERATOR">
<id name="id" >
<generator class="native" />
</id>
<property name="name" not-null="true">
<column name="NAME" />
</property>
<set name="pointCodes" inverse="false" lazy="true" cascade="save-update">
<key>
<column name="OperatorID" />
</key>
<one-to-many class="sample.PointCode" />
</set>
</class>
<hibernate-mapping>
<class name="sample.PointCode" table="POINTCODE">
<id name="id">
<generator class="native" />
</id>
<properties name="pointCodeKey" unique="true">
<property name="pointCode" not-null="true">
</property>
<property name="networkIndicator" not-null="true">
</property>
</properties>
<property name="name" not-null="true">
</property>
</class>
</hibernate-mapping>
Most of the time when featching an Operator I want the pointCodes to be fetched lazily, so I don't want to set lazy="false" in the mappings,
However I have one query, e.g. session.createQuery("from Operator").list()
where I do want the pointCodes association to NOT be fetched lazily - how do I do that ?