<div>Hi all,</div>
<div>I am using Hibernate for ORM.<br>Right now i am monitoring my application using JProfiler.<br>Here, i run my application and monitoring instances which are not garbage collected.<br>In one flow of my application, i have found that hibernate is instantiating objects on the basis of available records in<br>
corrosponding table. </div>
<div> </div>
<div>For example, I have tried to load <strong>BaseListing class</strong> which is child of <strong>UserDtls</strong> and when i load </div>
<div>BaseListing like as given below (DAO layer code snippet).</div>
<div> </div>
<div><strong><font size="2">baseListing = (BaseListing)getHibernateTemplate().load(BaseListing.</font></strong></div><font size="2"><strong><font color="#7f0055">class</font>, listingId);</strong> </font>
<div> </div>
<div>Here, it loads <strong>baselisting</strong> with all its containing objects including UserDtls where returned UserDtls object is one </div>
<div>but in jprofiler it shows 32 UserDtls allocations (Instance Allocations, <strong>here UserDtls table has 32 records</strong>) whereas </div>
<div>in baseListing it has loaded only one instance<strong>.</strong></div>
<div><strong></strong> </div>
<div>So JProfiler shows me this 32 as a non-GCed objects. </div>
<div> </div>
<div>Can anybody tell me that why hibernate is loading (creating instances of) UserDtls on the basis of available records into the UserDtls</div>
<div>even in baseListing it is assigning one instance of UserDtls.</div>
<div> </div>
<div>(The mapping files are as given below)<br>i.e<br>I have two classes BaseListing and UserDtls.<br>Following is a configuration snippet of both<br><strong>BaseListing.hbm.xml</strong><br><class name="test.BaseListing" table="base_listing" lazy="false"><br>
.........................<br><many-to-one name="userDtls" class="test.UserDtls" lazy="false"><br><column name="USER_ID" /><br></many-to-one<br>....................<span></span><span></span> <br>
</class><br></hibernate-mapping></div>
<div><br><strong>UserDtls.hbm.xml</strong><br><br><class name="test.UserDtls" table="user_dtls" lazy="false" ></div>
<div>...........................</div>
<div><set name="baseListings" inverse="true" fetch="select"><br><key><br><column name="USER_ID" /><br></key><br><one-to-many class="test.BaseListing" /><br>
</set<key><br>....................<br></class><br></hibernate-mapping><br> </div>
<div>Here,can any body tell me how can i make hibernate to load only required 1 instance</div>
<div> rather than unnecessary 32 instances of UserDtls.</div>
<div> </div>
<div>Regards,</div>
<div>Manish</div><span></span>