@Test @Transactional public void insertVisit() { Pet pet7 = this.clinicService.findPetById(7); int found = pet7.getVisits().size(); Visit visit = new Visit(); pet7.addVisit(visit); visit.setDescription("test"); // both storeVisit and storePet are necessary to cover all ORM tools this.clinicService.saveVisit(visit); this.clinicService.savePet(pet7); pet7 = this.clinicService.findPetById(7); assertEquals(found + 1, pet7.getVisits().size()); assertNotNull("Visit Id should have been generated", visit.getId()); }