commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14796] - ResultSetDynaClass.createDynaProperty uses getColumnName(i).toLowerCase()
Date Sun, 24 Nov 2002 22:11:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14796>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14796

ResultSetDynaClass.createDynaProperty uses getColumnName(i).toLowerCase()

kenfitzpatrick@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |



------- Additional Comments From kenfitzpatrick@yahoo.com  2002-11-24 22:11 -------
Thank you for your assessment.

Because the suggested code change was denied, I returned my PropertyUtils code
to the released version.  I then began to deal with the problems that that
originally created for me.  It might be interesting to review those and where
they lead me.

I agree that by setting all of the ColumnNames to lower-case, a predicatable
value is established.  However, this seems to render some of the target bean's
property Setter methods unusable, which causes PropertyUtils.copyProperties() to
leave many of the properties unset.  

For example, consider a target business bean class "Person" having a property
"firstName" with the JavaBeans-compliant accessor methods
"Person.getFirstName()" and "Person.setFirstName()".  The
"Person.setFirstName()" method is not recognized as a legitimate target by the
"PropertyUtils.copyProperties()" when copying the property values from the
ResultSetDynaBean to the target bean.  This is because the ResultSetDynaBean
would have had the SQL ColumnValue placed at the key "firstname", the lower-case
version of the actual property name of the target bean.

That left me two steps away from where I needed to be:

1 - I still needed to convert the ResultSetDynaBean's lower-case property names
to their respective JavaBean-compliant equivalents, as defined on the target
bean.  This is so the "PropertyUtils.copyProperties()" method can successfully
match the Setter methods on the target bean.

2 - I still needed to convert the Collection of ResultSetDynaBeans to a set of
as-many instances of the target bean.

In order to meet my objective of returning business beans from an SQL Select
where the ResultSetDynaBean class is used as described in the JavaDoc, I then
needed to develop the following 2 supplemental classes:

1 - DynaBeanPropertyNamesConverter
/**
 <p>
 Performs DynaBean PropertyName conversion services for DynaBeans whose 
 PropertyNames may have been standardized (e.g., perhaps, by having been 
 converted to lower-case) to a set of DynaBeans whose PropertyNames
 match those of a given Prototype object.
 </p>
 <p>
 This can be useful, for example, within the context of the DynaBeans 
 returned from the ResultSetDynaBean class, since the PropertyNames of 
 those DynaBeans will have been converted to all lower-case letters for
 consistency across DBMSs.
 </p>
 * @author  KenFitz
 */

2 - DynaBeansToObjectsExpander.java
/**
 Converts a Collection of DynaBeans to a Collection of instances of a 
 given Prototype object.
 *
 * @author  KenFitz
 */

Local instances of these two classes operate on the DynaBean results of the
ResultSetDynaBean in order for the final set of business bean instances to be
created and properly populated.

If my fundamental assessment of the problem is incorrect regarding the returning
of business beans using the ResultSetDynaBean, then I very much would like to
learn more about the intended solution.

Alternatively, if you agree that there remain unresolved aspects to the problem
set, perhaps we should further discuss those issues.  If appropriate, I would be
very happy to share my implementations with Apache.

Respectfully,
Ken Fitzpatrick

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message