Permalink
Browse files

Check for MANUAL/NEVER flush mode properly (use FlushMode.isManualFlu…

…shMode)
  • Loading branch information...
lhotari committed Apr 25, 2012
1 parent 0371073 commit 85c48ba2812fb5faaaacc56ab4dd8eeeec2cb2a9
@@ -38,7 +38,7 @@ public FlushOnRedirectEventListener(SessionFactory sf) {
public void responseRedirected(String url) {
new GrailsHibernateTemplate(sessionFactory).execute(new HibernateCallback<Void>() {
public Void doInHibernate(Session session) {
- if (session.getFlushMode() != FlushMode.MANUAL) {
+ if (!FlushMode.isManualFlushMode(session.getFlushMode())) {
session.flush();
}
return null;
@@ -69,7 +69,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
@Override
protected void closeSession(Session session, SessionFactory sessionFactory) {
- if (!FlushMode.MANUAL.equals(session.getFlushMode())) {
+ if (!FlushMode.isManualFlushMode(session.getFlushMode())) {
session.flush();
}
super.closeSession(session, sessionFactory);
@@ -131,7 +131,7 @@ private GrailsContentBufferingResponse getContentBufferingResponse(HttpServletRe
@Override
protected void flushIfNecessary(Session session, boolean existingTransaction) throws HibernateException {
- if (session != null && session.getFlushMode() != FlushMode.MANUAL) {
+ if (session != null && !FlushMode.isManualFlushMode(session.getFlushMode())) {
super.flushIfNecessary(session, existingTransaction);
}
}

0 comments on commit 85c48ba

Please sign in to comment.