-->
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: lazy=false from custom reven strategy
PostPosted: Tue Sep 08, 2009 9:46 am 
Newbie

Joined: Thu Jun 04, 2009 10:02 am
Posts: 6
Hi all,

How can I set lazy="false" in class/table definition when generating hbm.xml files?
I am using both a hibernate.reveng.xml file and a custom ReverseEngineeringStrategy, so in either case, just point me in a direction from where i can set properties in this... I would also like to NOT having hibernate to generate a catalog="xxxx" property, is this possible? I have yet to find a way to set "properties" in the class field...like:

<class name="path.to.class.Xxxx" table="Xxxx" lazy="false" >

Atm. it generates like this:

<class name="path.to.class.Xxxx" table="Xxxx" catalog="someCatalog" >

Thanks alot in advance!

BR Hovendal


Top
 Profile  
 
 Post subject: Re: lazy=false from custom reven strategy
PostPosted: Tue Sep 08, 2009 10:50 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Well, you really set the lazy option at the collection level.

The default is Lazy, with the exception of one-to-one mappings, so you're getting that benefit already.

Duplicate Post:

http://www.centa.com/staticpages/index. ... Deductible

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: lazy=false from custom reven strategy
PostPosted: Fri Sep 11, 2009 3:27 am 
Newbie

Joined: Thu Jun 04, 2009 10:02 am
Posts: 6
Hi, and thanks for replying!

Yes, I found out that setting lazy="false" in the class definition didn't really have the desired effect. But still, even thoug you say it is default, I have to add lazy="false" to collections I want fetched.

Generated by hibernate tools:
<many-to-one name="building" class="com.domain.Building" fetch="select">
<column name="BuildingId" not-null="true" />
</many-to-one>
What I need:
<many-to-one name="building" class="com.domain.Building" fetch="select" lazy="false">
<column name="BuildingId" not-null="true" />
</many-to-one>

The first one throws LazyInitializationException and I am not interested in using any view interceptors to open session in view... But how can I generate this lazy property on reverse engineering? Is it possible, when you state it is false by default? If it is, how come it has an effect to insert lazy="false"?

Thanks a lot!

BR Hovendal


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.