commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sumit S." <>
Subject ResultSetDynaClass etc...
Date Tue, 11 Nov 2003 13:05:16 GMT
The ResultSetDynaClass & ResultSetDynaBeans are a powerful way of encapsulating ResultSets
in DynaClasses. However, when we need to transfer the data from such a DynaClass to a ValueObject
(say a structs ActionForm), the PropertyUtils.copyProperties looks for a property name match.

So now my ActionForm attributes get tied to the DB Column names....and if at a later point
in time, the column names are changed, it means a change in code.

One option is to store the mapping information in a simple configuration file and override
the copyProperties to take this mapping info as an input parameter as well...

something like

copyProperties (Object dest, Object src, Map map)
    for each property in src
        read the value from source.
        get the corresponding property name in dest from the map
        set the property value in the dest

I have written a small class to do the above....
Is there a more elegant way of doing it.....The config might be XML or Text based which can
be converted into Map objects & cached.


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