@Test public void itShouldSaveMultipleSetsAssociatedToSameHandicapGroup() { daoTestRule.inTransaction(() -> { HandicapGroupHibernateEntity entity = HibernateEntityTestUtils.fullHandicapGroup(); entity.setId(null); entityDao.create(entity); HandicapGroupSetHibernateEntity setEntity1 = HibernateEntityTestUtils.fullHandicapGroupSet(); setEntity1.setId(null); setEntity1.setHandicapGroups(Sets.newHashSet()); setDao.create(setEntity1); HandicapGroupSetHibernateEntity setEntity2 = HibernateEntityTestUtils.fullHandicapGroupSet(); setEntity2.setId(null); setEntity2.setHandicapGroups(Sets.newHashSet()); setDao.create(setEntity2); assertThat(setEntity1.getId()).isNotEqualTo(setEntity2.getId()); setEntity1.getHandicapGroups().add(entity); setEntity2.getHandicapGroups().add(entity); setDao.update(setEntity1); setDao.update(setEntity2); }); }
@Override public void create(HandicapGroupSetHibernateEntity entity) { persist(entity); }
HandicapGroupSetDao extends BaseHibernateEntityDao<HandicapGroupSetHibernateEntity> { @Override public void create(HandicapGroupSetHibernateEntity entity) { persist(entity); } }
HandicapGroupSetDao extends BaseHibernateEntityDao<HandicapGroupSetHibernateEntity> { @Override public void create(HandicapGroupSetHibernateEntity entity) { persist(entity); } @Inject  HandicapGroupSetDao(SessionFactory sessionFactory); }
HandicapGroupSetDao extends BaseHibernateEntityDao<HandicapGroupSetHibernateEntity> { @Override public void create(HandicapGroupSetHibernateEntity entity) { persist(entity); } @Inject  HandicapGroupSetDao(SessionFactory sessionFactory); @Override void create(HandicapGroupSetHibernateEntity entity); @Override List<HandicapGroupSetHibernateEntity> findAll(); @Override HandicapGroupSetHibernateEntity findById(String id); }
HandicapGroupSetDao extends BaseHibernateEntityDao<HandicapGroupSetHibernateEntity> { @Override public void create(HandicapGroupSetHibernateEntity entity) { persist(entity); } @Inject  HandicapGroupSetDao(SessionFactory sessionFactory); @Override void create(HandicapGroupSetHibernateEntity entity); @Override List<HandicapGroupSetHibernateEntity> findAll(); @Override HandicapGroupSetHibernateEntity findById(String id);  }