SaveMethodInObjectFkPeer.doDelete(new Criteria());
SaveMethodInPeerPeer.doDelete(new Criteria());
SaveMethodInPeer toSave = new SaveMethodInPeer();
toSave.setPayload("payload");
SaveMethodInPeerFk child1 = new SaveMethodInPeerFk();
toSave.addSaveMethodInPeerFk(child1);
child1.setPayload("payload 1");
SaveMethodInObjectFk child2 = new SaveMethodInObjectFk();
toSave.addSaveMethodInObjectFk(child2);
child2.setPayload("payload 2");
// execute
SaveMethodInPeerPeer.save(toSave);
// verify
assertNotNull(toSave.getId());
assertEquals("payload", toSave.getPayload());
assertNotNull(child1.getId());
assertEquals("payload 1", child1.getPayload());
assertNotNull(child2.getId());
assertEquals("payload 2", child2.getPayload());
Criteria criteria = new Criteria()
.where(SaveMethodInPeerPeer.ID, toSave.getId())
.and(SaveMethodInPeerPeer.PAYLOAD, "payload");
List<SaveMethodInPeer> loadedList
= SaveMethodInPeerPeer.doSelect(criteria);
assertEquals(1, loadedList.size());
assertEquals(
1,
new CountHelper().count(SaveMethodInPeerPeer.getTableMap()));
criteria = new Criteria()
.where(SaveMethodInPeerFkPeer.SAVE_METHOD_IN_PEER_ID, toSave.getId())
.and(SaveMethodInPeerFkPeer.ID, child1.getId())
.and(SaveMethodInPeerFkPeer.PAYLOAD, "payload 1");
List<SaveMethodInPeerFk> child1List
= SaveMethodInPeerFkPeer.doSelect(criteria);
assertEquals(1, child1List.size());
assertEquals(