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?
|