-->
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.  [ 1 post ] 
Author Message
 Post subject: Unable to use lazy loading when using JAXB generated classes
PostPosted: Mon Apr 24, 2006 9:07 pm 
Newbie

Joined: Mon Apr 24, 2006 8:56 pm
Posts: 1
Hi,
I am trying to use JAXB objects instead of normal POJOs.
I am not able to use lazy-loading for a one-to-many association because JAXB invokes the getter method of collections from the setter method which makes Hibernate think that I have invoked the getter method manually and it loads all the collections
There is a one-to-many relationship between CalendarTemplate and DailyProfile.
This is my parent object mapping file:
<class
name="amazon.scheduleddelivery.deliverycalendar.vo.impl.CalendarTemplateVOImpl"
table="CALENDAR_TEMPLATE"
dynamic-update="true"
dynamic-insert="true"
>
<bag
name="dailyProfiles"
inverse="true"
cascade="all"
order-by="DAILY_PROFILE_ID asc"
lazy="true"
>
<key>
<column name="CALENDAR_TEMPLATE_ID" not-null="true"/>
</key>
<one-to-many
class="amazon.scheduleddelivery.deliverycalendar.vo.impl.DailyProfileVOImpl"
/>
</bag>

</class>

Here is the setter method code generated by JAXB
public void setDailyProfiles(java.util.List theDailyProfiles) {
java.util.List draft = new java.util.ArrayList();
if (null == theDailyProfiles) {
this.unsetDailyProfiles();
} else {
draft.addAll(theDailyProfiles);
java.util.List proxy = this.getDailyProfiles();
proxy.clear();
proxy.addAll(draft);
}
}
In the above code, getDailyProfiles() is invoked because of which Hibernate loads the collections automatically. Is there a way either in Hibernate or JAXB to overcome this behaviour?

Thanks,
Neel.


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

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.