Allows to make a relationship bi-directional. By default, when a
relationship end is defined, it is only navigable from the owning component
to the described end (default value is
null). Assigning a
reverse relationship ends instructs the framework that the relationship is
bi-directional. This implies several complementary features :
- When one of the relationship ends is updated, the other side is
automatically maintained by Jspresso, i.e. you never have to worry about
reverse state. For instance, considering a
Invoice -
InvoiceLine bi-directional relationship,
InvoiceLine.setInvoice(Invoice) and
Invoice.addToInvoiceLines(InvoiceLine) are strictly
equivalent.
- You can qualify a "N-N" relationship (thus creating an
association table in the data store behind the scene) by assigning 2
collection property descriptors as reverse relation ends of each other.
- You can qualify a "1-1" relationship (thus enforcing some
unicity constraint in the data store behind the scene) by assigning 2
reference property descriptors as reverse relation ends of each other.
Setting the reverse relation end operation is commutative so that it
automatically assigns bot ends as reverse, i.e. you only have to set the
property on one side of the relationship.