-->
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: Can hibernate converts a proxy to the real McCoy?
PostPosted: Thu Apr 21, 2005 7:18 am 
Beginner
Beginner

Joined: Tue Aug 10, 2004 8:59 am
Posts: 47
Hibernate version: 3.0

I have an entity bean class A which I would like to serialize and send over the network to an external system which knows nothing about hibernate. Moreover I have had to declare A lazy, which means that Hibernate represents instances of A using proxies.

Now I could just serialize the A proxies and send them to the external system, but then I would need the external system to include hibernate.jar which contains the proxy classes, and for design reasons I cannot do that.

So what I would much rather like to do was to call some API which converted a proxy instance into a real non-proxy instance of A. This means an API which creates a new A and sets its properties equal to the properties found in the proxy. Of course I could write this myself, but I would like to know if hibernate can do this for me.

Thanks.

Randahl


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 10:04 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Try something like this:

LazyInitializer li = (LazyInitializer)<your object>;
Object target = li.getImplementation();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 25, 2005 3:40 am 
Beginner
Beginner

Joined: Tue Aug 10, 2004 8:59 am
Posts: 47
Thanks alesj

At first I thought this would work, but it turns out hibernate still puts a SerializableProxy into the serialization stream.

Am I really the first guy on the planet who needs to serialize a persistent Java bean without hibernate's intervention?

I am looking for a mechanism which allows me to retrieve a persistent entity bean from my database and then serialize it the way it would have been if it was just a regular (non-hibernate) java bean. Can this not be done some way?

Randahl


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.