Hi,
Please excuse me if the quesstion seems dumb. I examined
Category.java and Item.java source code and find
both have
Code:
public void addCategorizedItem(CategorizedItem catItem) {
if (catItem == null)
throw new IllegalArgumentException("Can't add a null CategorizedItem.");
this.getCategorizedItems().add(catItem);
}
but association mapping for Item and Category also have inverse="true", which
imply that changes made at the CategorizedItem Collection on both
Item and Category should have no effect to database, hence code like
Code:
addCategorizedItem(..) above
should not propagate change to database. That's the idea presented in
page 110 of Hibernate in Action. Rather, I expect code like
Code:
class CategorizedItem ... {
public void addCategory(Category cat) {
getCategories().add( cat );
}
public void addItem(Item item) {
getItems().add(item);
}
......
}
to propagate change to database. So what's wrong with my
understanding???
Thanks,