-->
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: Disable Hibernate Proxies
PostPosted: Tue May 16, 2006 10:10 am 
Newbie

Joined: Tue May 16, 2006 10:00 am
Posts: 4
Location: Germany
hi there,

is there a way to disable the hibernate proxy generation programmatically or by configuration? So the proxy classes are replaced by simple null values?

I really don't need lazy loading and I want full controll which sql statements are actually called by hibernate. So specifiying lazy = "no" to my classes or assoziations is not an option.

I'm asking this because I don't wan't to add the hibernate.jar to my client (which is accessing an ejb which returns hibernate persisted entities.) as I'm not able to use lazy loading / the proxies on the client at all (No the session in View pattern or the copying of my entitiy objects into non hibernate pojos is not an option).

I really don't need the proxy stuff - but I did not find a solution to disable it :-(.

thanks in advance for your help

cheers Kai


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 10:16 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Hi,


we check the lazy flag using the following code:

Code:
for (Iterator iter = cfg.getClassMappings(); iter.hasNext();) {
   PersistentClass pc = (PersistentClass) iter.next();
   if( pc.isLazy() ) { // do something
   }
}


where cfg is an instance of Configuration.
You may change the lazy flag using:

Code:
pc.setLazy(false);


However I have not tested this.

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 10:34 am 
Newbie

Joined: Tue May 16, 2006 10:00 am
Posts: 4
Location: Germany
thanks, but this is not what we need. We would like Hibernate to return values where no proxies are present at all - but we don't wan't to use the lazy=true stuff as it leats to a huge amout of useless sql queries...

Well, i don't think there is a solution for this problems - seems that we need to introduce transfer objects that we sent to the client instead of the one retrieve by hibernate ;-(

cheers

Kai


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.