Suppose I have a class representing a list of other entities. I would like to initialize several lists with thier items in a minimum number of queries.
Currently, I can fetch all lists with a single query but fetching each list items requires a separate query for each list.
Hibernate version:
2.1.4
Mapping documents:
Code:
<hibernate-mapping>
<class
name="com.mercado.s2002.businessmng.objects.rules.ChangeLogListBO"
table="ChangeLogList"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="internalId"
column="Id"
type="long"
unsaved-value="0"
>
<generator class="com.mercado.s2002.datastore.mapping.IdGenerator">
</generator>
</id>
<version
name="version"
type="int"
column="version"
access="property"
unsaved-value="undefined"
/>
<list
name="list"
lazy="true"
inverse="false"
cascade="all"
>
<key
column="ListId"
>
</key>
<index
column="I"
/>
<one-to-many
class="com.mercado.s2002.businessmng.objects.rules.ChangeLogBO"
/>
</list>
</class>
</hibernate-mapping>
Name and version of the database you are using:
MySQL 4.0