示例#1
0
  @Test
  public void testImplicitFlushWithUpdates() throws Exception {
    int numInsert = 3;
    int numUpdate = 1;

    Session session = openSession();
    session.beginTransaction();
    Helicopter helicopter = helicopter("H_tmp");
    session.persist(helicopter);
    for (int i = 0; i < numInsert; i++) {
      session.persist(helicopter("H_" + i));
    }
    helicopter.setName("H_" + numInsert);
    session.getTransaction().commit();
    session.close();

    Assertions.assertThat(LeakingMongoDBDialect.queueSize).isEqualTo(numUpdate + (numInsert + 1));
  }
示例#2
0
 private Helicopter helicopter(String name) {
   Helicopter helicopter = new Helicopter();
   helicopter.setName(name);
   return helicopter;
 }