gscheibel/hibernate-ogm — comment on commit af5b87614d179d3141eca39d3f9af1b17b1dd2ba
File: hibernate-ogm-mongodb/src/test/java/org/hibernate/ogm/test/associations/embedded/CrudTest.java line 56
By emmanuelbernard:

interesting, you haven't told you you were using EntityManager's transactions. AFAIK, tx.commit() should trigger the flush automatically in this case. The code could be rewritten

EntityTransaction tx = em.getTransaction();
tx.begin();
em.persist(root);
tx.commit();
String id = root.getId();
em.close();