@Test public void itShouldSaveMultipleSetsAssociatedToSameCompetitionGroup() { daoTestRule.inTransaction(() -> { CompetitionGroupHibernateEntity entity = HibernateEntityTestUtils.fullCompetitionGroup(); entity.setId(null); entityDao.create(entity); CompetitionGroupSetHibernateEntity setEntity1 = HibernateEntityTestUtils.fullCompetitionGroupSet(); setEntity1.setId(null); setEntity1.setCompetitionGroups(Sets.newHashSet()); setDao.create(setEntity1); CompetitionGroupSetHibernateEntity setEntity2 = HibernateEntityTestUtils.fullCompetitionGroupSet(); setEntity2.setId(null); setEntity2.setCompetitionGroups(Sets.newHashSet()); setDao.create(setEntity2); assertThat(setEntity1.getId()).isNotEqualTo(setEntity2.getId()); setEntity1.getCompetitionGroups().add(entity); setEntity2.getCompetitionGroups().add(entity); setDao.update(setEntity1); setDao.update(setEntity2); }); }
@Override public void create(CompetitionGroupSetHibernateEntity entity) { persist(entity); }
CompetitionGroupSetDao extends BaseHibernateEntityDao<CompetitionGroupSetHibernateEntity> { @Override public void create(CompetitionGroupSetHibernateEntity entity) { persist(entity); } }
CompetitionGroupSetDao extends BaseHibernateEntityDao<CompetitionGroupSetHibernateEntity> { @Override public void create(CompetitionGroupSetHibernateEntity entity) { persist(entity); } @Inject  CompetitionGroupSetDao(SessionFactory sessionFactory); }
CompetitionGroupSetDao extends BaseHibernateEntityDao<CompetitionGroupSetHibernateEntity> { @Override public void create(CompetitionGroupSetHibernateEntity entity) { persist(entity); } @Inject  CompetitionGroupSetDao(SessionFactory sessionFactory); @Override void create(CompetitionGroupSetHibernateEntity entity); @Override List<CompetitionGroupSetHibernateEntity> findAll(); @Override CompetitionGroupSetHibernateEntity findById(String id); }
CompetitionGroupSetDao extends BaseHibernateEntityDao<CompetitionGroupSetHibernateEntity> { @Override public void create(CompetitionGroupSetHibernateEntity entity) { persist(entity); } @Inject  CompetitionGroupSetDao(SessionFactory sessionFactory); @Override void create(CompetitionGroupSetHibernateEntity entity); @Override List<CompetitionGroupSetHibernateEntity> findAll(); @Override CompetitionGroupSetHibernateEntity findById(String id);  }