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.  [ 3 posts ] 
Author Message
 Post subject: how to avoid the extra calling of sql for lazy property.
PostPosted: Tue Sep 13, 2005 7:55 am 
Newbie

Joined: Thu Sep 01, 2005 10:35 am
Posts: 8
hibernate config file is defined as below...

<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 ?

when a getter is invoked for lazy property, it again executes another sql query to get the value for that lazy property. 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: Tue Sep 13, 2005 12:44 pm 
Newbie

Joined: Thu Sep 01, 2005 12:39 pm
Posts: 16
Location: porto alegre, brazil
hummm....you can try "left join fetch"

_________________
Bsc. Tiago Martins
software engineer

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject: how to avoid the extra calling of sql for lazy property.
PostPosted: Wed Sep 14, 2005 8:28 am 
Newbie

Joined: Thu Sep 01, 2005 10:35 am
Posts: 8
hi tferraz,

sorry i m not getting u .

this is not enough information for solved that problem.

plz explain it.


again i try to explain my problem--



when i try to execute that query, that query has fired and it will give a lisl of UserRoles objects.



now when a getter is invoked for lazy property, it again executes another sql query to get the value for that lazy property.


how do we force Hibernate to map the resultset to POJO including lazy properties(as long as they are part of the sql projection)

i think now u better understand my problem.

so plz help me.


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