incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vijay Venkatachalam <>
Subject Info: How is Dao doing the update?
Date Mon, 03 Sep 2012 11:12:07 GMT

Today I came one step close to understand the way GenericDao has implemented
the update in DB.  I thought this understanding might be of use to someone who is new
to CloudStack like myself. Please read on

                Changes  in a setter in VO would never reflect in the DB.
public setName(String name) {
# it gets stored with the contents of argument "name" not ""
        = "Name: " + name;
                The setter functions of a VO are intercepted and stores
argument in a private list "_changes" and this is what is used to update the DB
at a later stage and *not* the object present in the member variable "".

                In my case I had a function like the following
                private String counterParameters;
setCounterParameters(Map map) {
                //loop through all the entry sets
                // concatenate them as a tempString  store it like the following
this.counterParameters = tempString;

I changed it as

# Plain vanilla function that is intercepted for update
setCounterParameters(String counterParmaaters) {
                this.counterParameters = counterParameters;
#custom setter which changes values
setCounterParametersForUpdate(Map map)
                // loop through all the entry sets
                // concatenate them as a tempString

Any other Recommendation?:
                Is there a better way to get the Fix done?

Vijay V.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message