@Test public void testNestableFlushEventListener() throws Exception { Session session = _prepareSession(); Transaction transaction = session.beginTransaction(); try { session.merge(_className1); session.merge(_className2); session.flush(); } finally { transaction.commit(); } session.close(); }
@Test public void testNestableAutoFlushEventListener() throws Exception { Session session = _prepareSession(); Transaction transaction = session.beginTransaction(); try { session.merge(_className1); session.merge(_className2); Query query = session.createQuery("SELECT className FROM ClassName className"); List<?> results = query.list(); Assert.assertFalse(results.isEmpty()); } finally { transaction.commit(); } session.close(); }