struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry Jalenak" <Jerry.Jale...@LABONE.com>
Subject RE: [OT - BeanUtils.populate] 'Case' of property name
Date Tue, 08 Oct 2002 21:02:10 GMT
Thanks for all of the replies...

I looked at BeanInfo and didn't think it would solve my problem. As far as
using an alias, I already am.  Apparently Oracle always returns column names
in uppercase - something about adhereing to ANSI standards.  For now I've
gone back to calling my bean setters individually :-(

Jerry

> -----Original Message-----
> From: Gideon, Thomas [mailto:Thomas.Gideon@B2eMarkets.com]
> Sent: Tuesday, October 08, 2002 1:52 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [OT - BeanUtils.populate] 'Case' of property name
> 
> 
> Probably the best solution is to alias the columns, if your 
> RDBMS supports
> this, in your select statement, so they match with your 
> JavaBean properties.
> To do so, you would alter the select clause to look like:
> 
> select SOMEFIELD as "SomeField",
> 	ANOTHERFIELD as "AnotherField",
> 	...
> from SOMETABLE
> where ...
> 
> What BeanInfo can give you is an instance of a PropertyEditor for some
> non-primitive property type, so given some arbitrary String 
> representing a
> complex data type value, the bean introspection code can easily do the
> conversion.  I'm not certain it provides any sort of aliasing 
> capability to
> work around mis-matched value and property names.
> 
> Thomas Gideon
> Sr. Software Developer
> B2eMarkets
> 
> 301.230.2236  Tel.
> 301.230.2248  Fax.
> thomas.gideon@B2eMarkets.com
> www.B2eMarkets.com
> 
> 
> 
> > -----Original Message-----
> > From: Jerry Jalenak [mailto:Jerry.Jalenak@LABONE.com]
> > Sent: Tuesday, October 08, 2002 12:32 PM
> > To: 'struts-user@jakarta.apache.org'
> > Subject: [OT - BeanUtils.populate] 'Case' of property name
> > 
> > 
> > I may just be out of luck, but maybe someone can tell me an 
> > easy way of
> > fixing this....
> > 
> > I get a ResultSet back from a database call.  Using 
> > ResultSetMetaData, I
> > grab the column names and values and put them in a HashMap.  
> > I then use
> > BeanUtils.populate to 'set' the values in a JavaBean.  The 
> > problem is that
> > the column names from the ResultSetMetaData are all in upper 
> > case; all of my
> > bean properties follow the normal naming scheme where the 
> > property starts
> > off in lower case, then each 'word' is capitalized.  Since
> > BeanUtils.populate doesn't find a matching setter method, it 
> > never copies
> > the data.  The JavaDoc for BeanUtils.populate talks about 
> > custom 'setter'
> > using something called a BeanInfo class, but I can't seem to 
> > find any info
> > on this (probably looking in the wrong place...).  Is there 
> > an easier way to
> > fix this other than renaming all of my properties (on my JSP, 
> > in my beans,
> > etc.)?
> > 
> > TIA!
> > 
> > Jerry Jalenak
> > Web Publishing
> > LabOne, Inc.
> > 10101 Renner Blvd.
> > Lenexa, KS  66219
> > (913) 577-1496
> > jerry.jalenak@labone.com
> > 
> > 
> > This transmission (and any information attached to it) may be 
> > confidential and is intended solely for the use of the 
> > individual or entity to which it is addressed. If you are not 
> > the intended recipient or the person responsible for 
> > delivering the transmission to the intended recipient, be 
> > advised that you have received this transmission in error and 
> > that any use, dissemination, forwarding, printing, or copying 
> > of this information is strictly prohibited. If you have 
> > received this transmission in error, please immediately 
> > notify LabOne at (800)388-4675.
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: 
> > <mailto:struts-user-help@jakarta.apache.org>
> > 
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


This transmission (and any information attached to it) may be confidential and is intended
solely for the use of the individual or entity to which it is addressed. If you are not the
intended recipient or the person responsible for delivering the transmission to the intended
recipient, be advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify LabOne at (800)388-4675.



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


Mime
View raw message