Let us say I created a transient attribute “customerStatusDescription”.
This attribute can store the value “Open” or “Close” depending on the values in other attributes.
I know of two (2) approaches that can be used to load the attribute:
One way is to define the “customerStatusDescription” attribute as a ReadOnly Transient attribute and then place logic inside the getter method in the Entity Class itself.
Another method is to place the logic inside a onBeforeDetach Entity Listener method.
So my question is:
Although I generally prefer the first approach, what are the advantages and disadvantages of using approach#2 ?
In what cases, is it better to use approach #2 ?