Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: Hibernate 3
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Block" table="tbl_block" lazy="true">
<id name="uid" type="string" column="block_uid">
<generator class="uuid" />
</id>
<many-to-one name="location" class="Location" column="location_uid" not-null="true" lazy="true" />
<property name="name" type="string" column="block_name" />
<property name="rate" type="float" column="rate" />
<many-to-one name="roomType" class="RoomType" column="room_type" not-found="ignore" lazy="true" />
<!-- <property name="roomType" type="string" column="room_type" />-->
<many-to-one name="bedType" class="BedType" column="bed_type" not-found="ignore" lazy="true"/>
<!-- <property name="bedType" type="string" column="bed_type" />-->
<property name="startDate" type="date" column="start_date" />
<property name="endDate" type="date" column="end_date" />
<property name="smoking" type="yes_no" column="smoking" />
<property name="deposit" type="yes_no" column="deposit" />
<property name="dateCreated" type="date" column="date_created" />
<property name="dateModified" type="date" column="date_modified" />
<property name="enabled" type="yes_no" column="enabled" />
<set name="reservations" cascade="all" inverse="true" >
<key column="block_uid" />
<one-to-many class="Reservation" />
</set>
<set name="blockNights" cascade="all,delete-orphan" inverse="true" >
<key column="block_uid" />
<one-to-many class="BlockNight" />
</set>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="BlockNight" table="tbl_block_night" lazy="true">
<id name="uid" type="string" column="block_night_uid">
<generator class="uuid" />
</id>
<many-to-one name="Block" column="block_uid" not-null="true" />
<property name="blockDate" type="date" column="block_date" />
<property name="maxOccupancy" type="integer" column="max_occupancy"/>
<property name="actualOccupancy" type="integer" column="actual_occupancy"/>
<property name="shoulderDate" type="yes_no" column="shoulder_date"/>
<property name="rate" type="float" column="rate"/>
<property name="dateCreated" type="timestamp" column="date_created" />
<property name="dateModified" type="timestamp" column="date_modified" />
<property name="enabled" type="yes_no" column="enabled" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():I am using Spring's HibernateTemplate and HibernateDaoSupport and using the OpenSessionInView Classes
Name and version of the database you are using: mySQL 4.1
The problem I think am having is that that it is trying to load up all the records of the I am making a request to my block detail view, which shows the Block record with the collection of blockNights. When I reference getting the collection in the view it wants to go grab all associations some of which are 5-6 assocations deep. which is about 15 different classes.
I have set hibernate property max_fetch_depth to 0.
Can anyone help me ?
Thank you in advance for any insight on my problem.