-->
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.  [ 4 posts ] 
Author Message
 Post subject: why is the class SessionImpl final?
PostPosted: Wed Aug 11, 2004 9:54 am 
Newbie

Joined: Tue Sep 16, 2003 9:01 am
Posts: 1
Hi,

I would like to extend (minor modify) the class 'SessionImpl', which is final.
Ok, I could write my own implementation of the interface 'Session' using a Decorator-Pattern delegating most work to a wrapped SessionImpl-object. But I'm not sure, if this is a good idea - because the class is final by design, not by mistake.

What is the reason for this design-decision? Is it ok to use my own implementation (createt by my own Factory 'DbSessionManager')?

thanks

-uwe-

--

Hibernate version: 2.1.4


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 10:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
It is final because that is not a supported extension point. What is it you are trying to do. Perhaps someone can suggest a better way, if we knew what you were trying to acheive by extending SessionImpl.

Plus extension of SessionImpl would be very dangerous. There's a lot of intricate state involved there of which you would need to have intimate knowledge to appropriately extend it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 10:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just use a wrapper around the normal SessionImpl if you want to implement custom functionality - this is much safer. And tell us what you want to do, perhaps we can suggest an easier way :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 9:39 am 
Newbie

Joined: Mon Jul 03, 2006 9:28 am
Posts: 2
michael wrote:
Just use a wrapper around the normal SessionImpl if you want to implement custom functionality - this is much safer. And tell us what you want to do, perhaps we can suggest an easier way :)


Hibernate 3.1

I write web-service application (fully singletone class, working with hibernate db)
I need track information about user who initialized some action with database. Session object is accessible through all event listeners. If i could have possibility to set and get arbitrary object with session - this might solve many problems (e.g. authorization).


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