Sep 15th, 2011, 03:00 PM
transient field property
In my entity class I have declared a transient field and created getter/setter methods. Based on a property of entity class, I have to populate the transient field value. As @Formula annotation is not working for me, I have to modify the getter method by calling a sql statement.
I am getting the value as per my desire, how ever my getter method is called 6times while show.jspx is called. All I can say is I have 6 fields defined in my entity class.
Why my getter method is called multiple times? Any help is highly appreciated.
Sep 20th, 2011, 10:21 AM
Please help me in understanding why the getter method is called multiple times. Also, how do I use init method using annotations? Will that solve this problem?
Sep 20th, 2011, 11:09 PM
The problem is that the Spring MVC EL integration uses the toString() method on your type quite frequently. Normally this has no major impact on your application but since you are calling DB functionality from your accessor it becomes a problem. The solution is to push in the toString() method into the .java source and remove the getXX() call from it. Alternatively you can remove the @RooToString annotation from the type.