-->
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.  [ 2 posts ] 
Author Message
 Post subject: Proxy materializing
PostPosted: Sat Feb 06, 2010 1:19 pm 
Newbie

Joined: Mon Dec 28, 2009 6:14 am
Posts: 6
Hello!

I have a method that loads a collection of UserAccounts when user logs in.
Each UserAccount refers to User object using many-to-one relationship.
So Users are loaded as lazy proxies and that's OK for authentication.

But after a user logged in, I have to send User object to the client (GWT RPC). I can't send the proxy to the browser. So it must be materialized for that.

How can this be done?

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Proxy materializing
PostPosted: Mon Feb 08, 2010 3:43 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Code:
if ( myinstance instanceof HibernateProxy)
         materialized =  ((HibernateProxy) myinstance).getHibernateLazyInitializer().getImplementation();
else
         materialized = myinstance;


N.B.: Be aware that "de-proxy" operation could hit the database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.