Archive for June, 2009

Hibernate Remote Lazy Loading to the Rescue

I've written a couple of posts recently on Lazy Loading, and some of the issues relating to how Hibernate creates and manages proxies.  While lazy loading itself is meant to improve performance, it can still lead to exceptions caused by objects being detached from their session.  As a web service becomes more distributed, and the number of requests increases the need for lazy loading remotely becomes more important, but implementing it without unintended consequences can be a little tricky.  Yesterday I ... Read more

Class Cast Exception is a Proxy Problem – Revisited using the Visitor Pattern

In my previous post: ClassCastException is a Proxy Problem I talked about how Hibernate tries to optimize the loading of objects by lazily fetching the parent class object, and returning a proxy for the subclass instead of the actual subclass, thus causing a ClassCastException when the proxy is cast to the actual subclass.  The proxied object doesn't contain member variables or a representation of the subclass' methods, only the parent's. My proposed solution to the ClassCastException was to add an enum for each subclass that would ... Read more

Her World – Installment 5

Jenna sat looking out of her bay window in her old brownstone.  As the sun's rays beamed on her face she drifted deep into thought;  this was the place she had hoped to call home again.  She hadn't had any expectations for her return.  She had always thought of this place as home, because of all the fond memories and experiences that took place here.  During her travels she would think about them, she would imagine herself laying in bed alone ... Read more