When I do following:
em.persist(entity);
em.getTransaction().commit();
After execution of second line,I can see SQL Insert in traces and a row in DB inserted. But when I do:
em.persist(entity);
em.flush();
em.getTransaction().commit();
In this case, I can see SQL Insert in traces after execution of second line, but no new row is inserted in DB. That happens only after third line is executed.
Shouldn't an INSERT put a row in DB as soon as it is fired?