-->
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: serializable-type, caching and performance question.
PostPosted: Wed Jan 21, 2004 10:24 am 
Newbie

Joined: Wed Jan 21, 2004 8:43 am
Posts: 5
I've used the serializable-type to get hibernate to store third-party objects I use as delegates in my own objects. The object is accessible as a property in my object.

This seemed like the best choice since the alternatives (as far as I know) was:

1. To create a hibernate-mapping of the third party object (of which I know little other than that it is serializable).

2. To include all parameters needed in my object to re-instantiate the 3rd party object when needed, which in my case can be arbitrarily complex.

The serializable-type however just plain works, with little effort on my part. There is however a catch:

In my ejbs, the objects are requested each session. Hibernates caching speeds everything up nicely, EXCEPT for the serialized objects. Profiling reveals that only the bytes are cached, and the object is de-serialized each time I ask for it. Is there a way to get hibernate to cache the deserialized object, or do I have to implement my own cache?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 2:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You should be able to use a CompositeUserType to implement a customized cache assembly/disassembly algorithm. However, I don't think this would be right - objects have to be deep copied in and out of the cache.


Top
 Profile  
 
 Post subject: Quick and dirty solution.
PostPosted: Mon Feb 09, 2004 12:40 pm 
Newbie

Joined: Wed Jan 21, 2004 8:43 am
Posts: 5
A colleague of mine implemented a quick-and-ditry solution, by persisting the bytestream instead, and de-serializing on demand. This worked very well for our application, since the delegates are rarely used.


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.