If you use Hibernate, you may have seen the “inverse” attribute. I found this simple explanation:
Essentially “inverse” indicates which end of a relationship should be ignored, so when persisting a parent who has a collection of children, should you ask the parent for its list of children, or ask the children who the parents are?
Why does this matter? Well if you are stupid then you might do something like:
Parent parentA = new Parent(); Parent parentB = new Parent(); Child child = new Child(); parentA.getChildren().add(child); child.setParent(parentB);how should hibernate persist this situation? For unidirectional one–to–many it is trivial; only one end of the relationship is modelled (there is only parent.addChild(), not child.getParent()), but when it is bidirectional (parent.getChild and child.getParent*) you need to indicate whether the one–to–many is inverse or not.
What does it mean to be inverse? It informs hibernate to ignore that end of the relationship. If the one–to–many was marked as inverse, hibernate would create a child–>parentB relationship (child.getParent). If the one–to–many was marked as non–inverse then a child–>parentA relationship would be created.
From: Hibernates bizarre interpretation of inverse.
* Originally it reads: “child.getChildren”, but Silvia Ruiz get my attention it must reads: “child.getParent”.
More on this here: Inverse attribute of Hibernate.

