-->
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: Getting back to a Proxyified POJO Reference
PostPosted: Tue Apr 24, 2007 3:51 am 
Newbie

Joined: Tue Aug 08, 2006 3:53 am
Posts: 17
Location: Tanznaia
Dear All,

I have a tricky little problem. An object is loaded and then the session is closed. Later a new session opens and the object needs to be attached to this new session so that lazy collections work. This is no problem with the Lock command.

However, by this time I've got a non-proxified version the original object. It's still got proxified collections within it that need re-attaching and presumably there is sill a proxy wrapper for it floating around somewhere (even if the original session is closed). If I want to use Lock, I need this proxified reference again.

So, my question: How do you lookup the proxified reference to a POJO when you only have the original pojo to hand? I also don't have a reference to the original session, so I can't do a new lookup.

Any thoughts?

Now I know that this sounds like my architecture is a bit screwy, but it's really not. It's all very clean actually. Perhaps too clean : this problem is the result of a very clear seperation of GUI and Domain Model code...

My only workarround (not yet tested) is to use a listener to watch out for LoadEvents and SaveOrUpdateEvents on the POJO and quickly stash a reference to it's proxified version in the pojo itself. Then I can do something like..

Code:
session.lock(object.getProxifiedReference(), LockMode.NONE);


This is clearly a hack. I hope I'm missing a Hibernate feature....

I look forward to hearing your thoughts.

Regards,

Ben.


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.