Reputation: 1186
I have a spring web application where I want to block hibernate's insert/delete/update operation if the user in httpSession is a kind of Super user (where user.isSuper() returns true).
I have implemented listener for these events but the problem is that listener is not firing for HQL queries(session.executeUpdate()).
Same problem is with interceptors as well.
Please help.
Upvotes: 6
Views: 1199
Reputation: 5050
Try this following code instead of session.executeUpdate() :-
getSessionFactory().getCurrentSession().setFlushMode(FlushMode.NEVER);
getSessionFactory().getCurrentSession().close()
Upvotes: 1