Web / Apache OFBiz Interview questions
Why would you use a dynamic-view-entity instead of a predefined view-entity?
A predefined view-entity is declared once in XML and fixed - great for a join you'll reuse everywhere. A DynamicViewEntity is built at runtime in Java, letting you assemble member entities, aliases, and conditions on the fly based on parameters only known when the code executes - a search screen with optional filters, for example.
You'd reach for a dynamic view when the exact combination of joined entities or fields varies per call (optional filters, user-selected columns) and hardcoding every possible combination as static XML view-entities would be impractical.
The trade-off is that dynamic views live in Java code rather than declarative XML, so they're less discoverable and take a bit more work to maintain than a static view-entity used for a fixed, well-known join.
More Related questions...