-->
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.  [ 1 post ] 
Author Message
 Post subject: Http Session storing corrupts Proxy?
PostPosted: Sat Nov 15, 2008 9:12 am 
Newbie

Joined: Sat Nov 15, 2008 8:52 am
Posts: 2
Hi

We have a workaround for this but if anyone knows the reason why I'd be pleased to here.

We have an application that stores a User object in the http session.
As this object has lazy associations we rebind it to the current hibernate session each request (using lock and if that fails merge).

User has a link to the owning Company. Company is an abstract class , which is the parent of Brand, Dealer etc. Typed companies have links to other typed companies. For example Dealer getParent() returns a sales company and sales company getParent() returns a Group Company and so on.

These are all mapped correctly and typed. Company has no getParent() method, it is only implemented in the concrete sub classes.

When we use the Company returned by user.getCompany() this can cause a problem wih the 'narrowing' issue because the company proxy is not a dealer proxy etc. We understand this and have taken steps to avoid the problem.

However, this is the strange part. If we wait on a screen for five minutes the application occasionally blows up when we bind the user to the Hibernate session on the next request, because we cascade the lock down from company to the linked companies and we get a class cast exception saying expected Group Company got Admin Organisation. There is nothing wrong with the data and if we hadn't waited for a few minutes the code would have worked.

Our feeling is that either the http session is being written to disk and corrupting the object in session or the Hibernate second level cache is being written to disk and the object returned is corrupted.

As I say , we have a workaround (don't use hibernate objects in Http Session!) but I'd be happy to hear if anyone can explain this conundrum.

Thanks

Nick


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.