-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Lazy loading issue or lack of ?
PostPosted: Wed Dec 21, 2005 10:11 pm 
Newbie

Joined: Sun Dec 18, 2005 12:59 am
Posts: 2
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.


Top
 Profile  
 
 Post subject: More info
PostPosted: Wed Dec 21, 2005 10:17 pm 
Newbie

Joined: Sun Dec 18, 2005 12:59 am
Posts: 2
This is the hibernate code:

Code:
...
   public Block getBlock(String uid) {
      return (Block)getHibernateTemplate().load(Block.class, uid);
   }

...



[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.