-->
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: Forcing When Interceptors fire
PostPosted: Mon Dec 13, 2010 2:41 pm 
Newbie

Joined: Mon Dec 13, 2010 2:22 pm
Posts: 1
Hi

i have a contention issue with an app. The solution is to re-write how we use the audit info and when. however, for a quick patch fix, I was wondering if I can force when a Interceptor fires or when not.

I have

Code:
public class AuditInterceptor extends EmptyInterceptor implements Interceptor, Serializable {
// some stuff


    public boolean onSave(
            Object entity,
            Serializable id,
            Object[] state,
            String[] propertyNames,
            Type[] types) {

          //impl
    }
}


This gets called all over the place but, on very rare occasions, it gets called in the session's commit() and this can cause a block in the DB. Without doing into details we end up frozen in a loop tween DB block and Java lock().

So, clearly, bad design but until fully sorted is there a way to force the commit to rollback if the Interceptor fires during commit() (now the weird thing is that the interceptor is only updating the audit information (and optimistic lock count) on the entity already being modified in the transaction)? Or force the interceptor to fire int he preparetocommit() only?

Apologies if this is old news or daft question but trying to get to grips with Hibernate innards here :)

Hib 3.2.5, Java 5 and Spring

Simon


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