}
@Override
protected void update()
{
PersonUMM p1 = (PersonUMM) dao.findPerson(PersonUMM.class, "unimanytomany_1");
Assert.assertNotNull(p1);
p1.setPersonName("Saurabh");
Assert.assertEquals(2, p1.getAddresses().size());
for (AddressUMM address : p1.getAddresses())
{
address.setStreet("Brand New Street");
}
dao.merge(p1);
PersonUMM p1AfterMerge = (PersonUMM) dao.findPerson(PersonUMM.class, "unimanytomany_1");
Assert.assertNotNull(p1AfterMerge);
Assert.assertEquals("Saurabh", p1AfterMerge.getPersonName());
Assert.assertEquals(2, p1AfterMerge.getAddresses().size());
for (AddressUMM address : p1AfterMerge.getAddresses())
{
Assert.assertEquals("Brand New Street", address.getStreet());
}
PersonUMM p2 = (PersonUMM) dao.findPerson(PersonUMM.class, "unimanytomany_2");
Assert.assertNotNull(p2);
Assert.assertEquals(2, p2.getAddresses().size());
p2.setPersonName("Vijay");
for (AddressUMM address : p2.getAddresses())
{
address.setStreet("Brand New Street");
}
dao.merge(p2);
PersonUMM p2AfterMerge = (PersonUMM) dao.findPerson(PersonUMM.class, "unimanytomany_2");
Assert.assertNotNull(p2AfterMerge);
Assert.assertEquals("Vijay", p2AfterMerge.getPersonName());
Assert.assertEquals(2, p2AfterMerge.getAddresses().size());
for (AddressUMM address : p2AfterMerge.getAddresses())
{
Assert.assertEquals("Brand New Street", address.getStreet());
}
}