What Are Entity Associations Good For?
By Steve Muench on Nov 02, 2009
A few different people have asked me in the past week to help them understand what functionality they would be missing if they were to decide not to define any entity associations and instead just use view links to connect their view objects.
By defining (let's say a 1-to-many) association between two
entities Dept and Emp, you enable yourself to:
- Navigate programmatically (in Java or Groovy) between an instance of Dept and associated Emp instances and vice versa. This can be useful in navigation and business logic
- Easily add reference information like a Dname description to a view object based on Emp, and to automatically synchronize that reference information correctly when the foreign key (Emp.Deptno) value changes
- Easily define view links by just pointing to the association (since it already captures the attribute pairs involved in the relationship)
- Enable LOVs to be configured on the "reference description" field (e.g. "Dept.Dname") and have the related foreign key attribute (Emp.Deptno) be populated when the user chooses a department by name from the LOV.
- Leverage runtime "pruning" of attributes and joins when you build a VO with SQL Mode of "Declarative" and you happen to be only showing information related to some of the view objects (see example#141)
- See the relationships between their entity objects in a business components diagram
There are probably more. These were just the first six things that popped into my head... I'll update this posting if I think of others.