-->
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.  [ 5 posts ] 
Author Message
 Post subject: change properties on runtime
PostPosted: Mon Jul 12, 2004 6:20 am 
Newbie

Joined: Mon Jul 12, 2004 6:13 am
Posts: 7
Can I change some hibernate entity properties
(such as lazy=true to lazy=false for collections) at runtime?

Thanks,
Remizov Dmitry.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 7:24 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Get the PersistentClass metadata from the Configuration, change the setting, rebuild the SessionFactory. Or, which is what you probably really need, learn about the runtime fetching options with HQL ("fetch" keyword) and Criteria (FetchMode).

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 7:39 am 
Newbie

Joined: Mon Jul 12, 2004 6:13 am
Posts: 7
Thanks,
but I am already trying to use metadata

ClassMetadata meta=factory.getClassMetadata(MyClass.class);
String[] props=meta.getPropertyNames();

in property names there are only my fields names, how can I access
another properties defined in *.hbm.xml file.

Remizov Dmitry.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 7:42 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Not the SessionFactory, the Configuration. There are two different metamodels in Hibernate.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 9:36 am 
Newbie

Joined: Mon Jul 12, 2004 6:13 am
Posts: 7
Thanks it works.
Both aproach
1.PersistentClass pclass = conf.getClassMapping(MyClass.class) ....
with factory rebuild
2.Criteria.setFetchMode


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