public void testSave() throws Exception { CompassSession session = compass.openSession(); // (AGR_OSEM) ... CompassTransaction tr = session.beginTransaction(); Session hibSession = sessionFactory.openSession(); Transaction hibTr = hibSession.beginTransaction(); Roof r1 = new Roof(); r1.setName("the roof"); Foundations f1 = new Foundations(); f1.setName("foundations"); House h1 = new House(); h1.setName("my house"); h1.setRoof(r1); r1.setHouse(h1); h1.setFoundations(f1); // (AGR_OSEM) ... assertEquals(0, // session.queryBuilder().matchAll().setTypes(Roof.class).hits().length()); // (AGR_OSEM) ... assertEquals(0, // session.queryBuilder().matchAll().setTypes(House.class).hits().length()); hibSession.save(h1); // objects are present in index after save, before commit // (AGR_OSEM) ... assertEquals(1, // session.queryBuilder().matchAll().setTypes(Roof.class).hits().length()); // (AGR_OSEM) ... assertEquals(1, // session.queryBuilder().matchAll().setTypes(House.class).hits().length()); // (AGR_OSEM) ... tr.commit(); session.close(); hibTr.commit(); hibSession.close(); }