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.  [ 6 posts ] 
Author Message
 Post subject: Can proxied/instrumented class be deserialized in other JVM?
PostPosted: Fri Jun 03, 2005 9:23 am 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
Does (de-) serialization still work if a mapped class is dynamically proxied / instrumented by hibernate and its objects are deserializated in another JVM (e.g. cluster) ?

As far as I know a CGLIB generated class is not kown in another VM.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 03, 2005 10:49 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It is possible to serialize CGLIB proxies using custom "writeReplace" method, but it doe's not make any sence in this case, proxy needs session/connection to load the real object, you will need to load all objects from database before to serialize proxy.
It must be better to cluster cache (or not to use any global scope cache) and to store identifiers only out of transaction scope.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 11:18 am 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
As far as I understand hibernate is cluster-safe in case of a
*session-per-transaction* usage scenario. The session will never be serialized because it simply is closed by the time my SFSB is passivated, am I right?

But how about the *session-per-application-transaction* use case? In that case my 1st level session cache is full of objects, some of them instrumented by CGLIB. Thus, after passivation of my SFSB in one container another container wont be able to deserialize my objects in another VM.

So is it true that *session-per-application-transaction* cannot be used in a cluster? If yes, is there a way to generate the proxies at build time?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 12:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can serialize those objects fine as long as the "other" side have the proper classes in the classpath. i think something like cglib, hibernate and commons-logging should be enough.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 12:45 pm 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
Hi max,

I guess cglib.jar and hibernate.jar wont be sufficient in this case.

The "proper classes" is exactly what I care about : how does the other JVM know about the proxy class definition which was dynamically created by another VM? Will hibernate regenerate the proxy class on the other side ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 1:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
did you even try this before asking ?

yes hibernate does stuff to allow it to be serialized otherwise it would be freaking hard to use detached objects instead of DTO's.

/max

_________________
Max
Don't forget to rate


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