-->
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.  [ 7 posts ] 
Author Message
 Post subject: Stateless Session with Interceptor?
PostPosted: Tue Feb 14, 2006 6:18 pm 
Newbie

Joined: Mon Oct 24, 2005 2:19 pm
Posts: 10
Is there any earthly reason why a stateless session does not allow interceptors?

The StatelessSessionImpl constructur is hardcoded to use an empty interceptor.


Top
 Profile  
 
 Post subject: Re: Stateless Session with Interceptor?
PostPosted: Thu Feb 16, 2006 8:59 am 
Newbie

Joined: Mon Oct 24, 2005 2:19 pm
Posts: 10
Hm, I tried and modified the source code, so that StatelessSessionImpl has an overloaded constructor that takes an interceptor. I also modified the session factory, so that it provides access to this constructor.

For my case it is working nicely: Adjusting the generated sql in onPrepareStatement(). This is to redirect inserts to an inherited table - which is postgres's way of partitioning. There are other ways to do this in the db directly (rules or triggers), but those ware way slower.

Can this be made part of Hibernate itself?

SFriedrich wrote:
Is there any earthly reason why a stateless session does not allow interceptors?

The StatelessSessionImpl constructur is hardcoded to use an empty interceptor.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 1:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
only reason currenlty is that most of the operations on Interceptor does not make sense for Stateless session.

put a request in jira for your usecase...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 1:40 pm 
Newbie

Joined: Mon Oct 24, 2005 2:19 pm
Posts: 10
Thanks a lot for the answer.
I've done that:
http://opensource2.atlassian.com/projec ... e/HHH-1497


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 27, 2006 2:50 am 
Newbie

Joined: Thu Sep 15, 2005 6:53 am
Posts: 7
i feel requirement to have new instamce of interceptor per session is not un common. For e.g if audit using interceptor api is to be done in managed environment then we have no existing api to support this.

We need to overload getCurrentSession() method, to accept Interceptor. Reaosn is say in audit, we need to pass userId. auditID, userComment to be available to call back methods of interceptor.
MyInterceptor interceptor = new MyInterceptor("userId");
Session session = SF.getCurrentSession(interceptor);
DAO.method( session);
session.flush()

In the callback methods onSave or postFlush userID will be available.


Top
 Profile  
 
 Post subject: Re: Stateless Session with Interceptor?
PostPosted: Tue Oct 19, 2010 12:05 pm 
Regular
Regular

Joined: Tue Feb 19, 2008 6:05 pm
Posts: 82
Whats the use of putting it on JIRA
http://opensource.atlassian.com/project ... e/HHH-1497
so it stays there unfixed for years.


Top
 Profile  
 
 Post subject: Re: Stateless Session with Interceptor?
PostPosted: Wed Oct 20, 2010 7:12 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
pvradhakrishna wrote:
Whats the use of putting it on JIRA
http://opensource.atlassian.com/project ... e/HHH-1497
so it stays there unfixed for years.


Then fix it and send the patch.


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