-->
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.  [ 2 posts ] 
Author Message
 Post subject: Guidlines on SessionFactory scoped interceptor
PostPosted: Sun Jun 25, 2006 7:47 am 
Newbie

Joined: Tue Mar 07, 2006 5:51 am
Posts: 11
Location: India
Hello :

I am using Hibernate 3.1 in managed CMT environment with JBoss 3.2.7. I have to implement a Audit Inteceptor for all the entities for setting modified date time and modified user. Since I have configured Hibernate to work in a managed environment, I am using the getCurrentSession() method in SessionFactory to get the session. Since getCurrentSession() will use the interceptor registered with the SessionFactory, I have to implement a SessionFactory scoped interceptor.

My concerns are :

1. Does the org.hibernate.Intercpetor interface methods onSave, onFlushDirty has to be synchronized for SessionFactoryScoped interceptor implementation since it is mentioned that SessionFactory scoped interceptors must be thread safe.
http://www.hibernate.org/hib_docs/v3/reference/en/html/events.html

2. If it has to synchronized, can it become a performance bottleneck since at every Tx Commit / Rollback these synchronized methods wil be called for every object creation / modification and deletion ?

3. For the modified user information to be audited, I am planning to use a thread local to share the state across the sessions. Is any other elegant methods exists in the case of Session scoped intercpetor ?

4. Other than the method quoted above, is there any elegant method exists for auditing in a managed environment where getCurrentSession() is used instead of openSession() or opensession( Interceptor interceptor ) ? I read about events but the same issues with threading and state exists in that approach also and intercpetor seemed simpler to me.

Am I missing something since I have searched the doc and forum and did not find answer to the above queries. Any pointers / guidance will be really helpful.

thanks and regards,

-- Kannan.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 27, 2006 2:21 am 
Newbie

Joined: Tue Mar 07, 2006 5:51 am
Posts: 11
Location: India
Hello:

Am I missing anything obvious or haven't followed any standards in posting the question ? No response from the community for three days..

thanks and regards,

-- Kannan.


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