-->
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.  [ 4 posts ] 
Author Message
 Post subject: Qns regarding lazy=true properties..
PostPosted: Fri Sep 09, 2005 11:54 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:45 pm
Posts: 38
hibernate config file is defined as below...

Code:
<hibernate-mapping package="com.onebeacon.diarytracking.ormapping.domain">
     <class name="UserRoles" table="UserRoles">
          <composite-id name="comp_id" class="UserRolesPK">
               <key-property name="Role_CDE" column="Role_CDE" type="java.lang.String" length="25" />
               <key-property name="Novell_ID" column="Novell_ID" type="java.lang.String" length="8" />
          </composite-id>
          <property name="Role_CDE" column="Role_CDE" type="java.lang.String" length="25" lazy="false" insert="false" update="false" />
          <property name="PrimaryRole_IND" column="PrimaryRole_IND" type="java.lang.Byte" length="1" lazy="true" />
          <property name="Novell_ID" column="Novell_ID" type="java.lang.String" length="8" lazy="false" insert="false" update="false" />
     </class>
     <sql-query name="UserRoles.getUserRoles">
          <return class="UserRoles" />
          <![CDATA[SELECT Novell_ID, Role_CDE, PrimaryRole_IND  FROM UserRoles WHERE Novell_ID =:Novell_ID]]>
     </sql-query>
</hibernate-mapping>



Using ANT script, UserRoles class is modified for runtime bytecode interception.

Now my question is - when I execute "UserRoles.getUserRoles" sql-query of this mapping, does it populate PrimaryRole_IND inside UserRoles class, even though PrimaryRole_IND is marked as lazy=true ?

After running multiple tests, I came to a conclusion that lazy properties are ignored when mapping sql-query resultset to POJO class. And as a result, when a getter is invoked for lazy property, it again executes another sql query to get the value for that lazy property. Is my understanding correct? If yes, how do we force Hibernate to map the resultset to POJO including lazy properties(as long as they are part of the sql projection)

Please help !!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 11:00 am 
Newbie

Joined: Thu Sep 01, 2005 10:35 am
Posts: 8
i was also facing same problem and i haven't found the solution yet.


so please help me.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 4:18 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:45 pm
Posts: 38
Hibernate Gurus,
Please help!!

This is becoming a major performance issue for our client... I'd really appreciate any reference to resolve this problem..


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 11:16 pm 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
Hi,

nrbhattad wrote:
Hibernate Gurus,
Please help!!

This is becoming a major performance issue for our client... I'd really appreciate any reference to resolve this problem..

Though I'm not a guru, I'm certainly willing to help - but could you first help me reproduce your problem easier by providing:
1) the Hibernate version you are using
2) as much of the code that produces the error as possible so that I can easily recreate the error

Erik


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.