@Override public void onSetUpBeforeTransaction() throws Exception { super.onSetUpBeforeTransaction(); Session session = sessionFactory.openSession(); SessionHolder.setSession(session); Indexer indexer = new Indexer(); session.beginTransaction(); try { indexer.indexWithHibernate(); } catch (Exception e) { logger.error(e); logger.debug("Rolling back the database transaction"); session.getTransaction().rollback(); } finally { try { if (session != null) { session.close(); } } catch (Exception e) { /* do nothing */ logger.info("Can't close the session! (ignore it)"); } } // Lucene index }