When using collections in Hibernate, specifically bags for many-to-many
relationships, what's the best way to go about getting assertEquals to work.
For example, if how could I get simple "see if updating works" code
along the lines of the below to pass the final assertEquals?
List children = new ArrayList(2);
children.add(child1);
children.add(child2);
parent.setChildren(children);
parent.addChild(child2);
Parent stored = session.find("from Parent where id='dad'");
// getChildren() returns a Bag, which isn't equal to the
// above ArrayList children.
// returns false, failing test
assertEquals(parent, stored); |