@Test
  public void testInsertGetUpdateGet() {
    Session session = sf.openSession();
    DummyEntity e = new DummyEntity(1L, "test", 0d, null);
    Transaction tx = session.beginTransaction();
    try {
      session.save(e);
      tx.commit();
    } catch (Exception ex) {
      ex.printStackTrace();
      tx.rollback();
      fail(ex.getMessage());
    } finally {
      session.close();
    }

    session = sf.openSession();
    try {
      e = (DummyEntity) session.get(DummyEntity.class, 1L);
      assertEquals("test", e.getName());
      assertNull(e.getDate());
    } catch (Exception ex) {
      ex.printStackTrace();
      fail(ex.getMessage());
    } finally {
      session.close();
    }

    session = sf.openSession();
    tx = session.beginTransaction();
    try {
      e = (DummyEntity) session.get(DummyEntity.class, 1L);
      assertEquals("test", e.getName());
      assertNull(e.getDate());
      e.setName("dummy");
      e.setDate(new Date());
      session.update(e);
      tx.commit();
    } catch (Exception ex) {
      ex.printStackTrace();
      tx.rollback();
      fail(ex.getMessage());
    } finally {
      session.close();
    }

    session = sf.openSession();
    try {
      e = (DummyEntity) session.get(DummyEntity.class, 1L);
      assertEquals("dummy", e.getName());
      Assert.assertNotNull(e.getDate());
    } catch (Exception ex) {
      ex.printStackTrace();
      fail(ex.getMessage());
    } finally {
      session.close();
    }
    //        stats.logSummary();
  }
 @Test
 public void testInsertEvictUpdate() {
   insertDummyEntities(1);
   Session session = sf.openSession();
   Transaction tx = session.beginTransaction();
   DummyEntity ent = (DummyEntity) session.get(DummyEntity.class, 0L);
   sf.getCache().evictEntity("com.hazelcast.hibernate.entity.DummyEntity", 0L);
   ent.setName("updatedName");
   session.update(ent);
   tx.commit();
   session.close();
   ArrayList<DummyEntity> list = getDummyEntities(sf, 1);
   assertEquals("updatedName", list.get(0).getName());
 }
 protected void updateDummyEntityName(SessionFactory sf, long id, String newName) {
   Session session = null;
   Transaction txn = null;
   try {
     session = sf.openSession();
     txn = session.beginTransaction();
     DummyEntity entityToUpdate = (DummyEntity) session.get(DummyEntity.class, id);
     entityToUpdate.setName(newName);
     session.update(entityToUpdate);
     txn.commit();
   } catch (RuntimeException e) {
     txn.rollback();
     e.printStackTrace();
     throw e;
   } finally {
     session.close();
   }
 }