Inverse attribute of Hibernate
Writing about Hibernates bizarre interpretation of inverse ;) from Colin's blog
Think inverse as the “ignore”
inverse = true means to ignore the relationship of this side
inverse = false means not to ignore the relationship of this side
In parent-child relationship, parent is one side and children are many side.
one-to-many inverse=”false”
means relationship of parent side should not be ignored. So
parent.getChildren() will be examined, child.getParent() is ignored
For the following example:
Parent parentA = getParentA();
Parent parentB = getParentB();
child = new Child();
parentA.getChildren().add(child); Will be used
child.setParent(parentB); Will be ignored
Hongfeng Sun
Add a comment
You are not allowed to comment on this entry as it has restricted commenting permissions.