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 Wed, 09 Oct 2002 19:15:16 GMT
Thomas - 

THANK YOU!  Even my overpaid Oracle DBA's couldn't figure this one out!
Using the escaped double quotes worked like a charm!  Thanks again!

Jerry

> -----Original Message-----
> From: Gideon, Thomas [mailto:Thomas.Gideon@B2eMarkets.com]
> Sent: Wednesday, October 09, 2002 1:44 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [OT - BeanUtils.populate] 'Case' of property name
> 
> 
> Single quotes and double quotes mean different things in 
> PL/SQL and are not
> interchangeable.  You need to use double quotes for your 
> column aliases, the
> single quotes are causing Oracle to expect something other 
> than a column
> alias.  You may also need to use the "as" keyword between the 
> column name
> and the double quoted alias.  You should be able to escape 
> the double quotes
> in your embedded SQL so they don't cause your Java compiler 
> to complain by
> pre-fixing them with a back slashes:
> 
> ps = con.prepareStatement("SELECT DISTINCT " +
> 	"case_detail_1.case_id as \"id\", " +
> 	"f_get_param(case_detail_1.id, 'last_name') as \"lastName\", " +
> 	...
> 
> 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: Wednesday, October 09, 2002 12:37 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: [OT - BeanUtils.populate] 'Case' of property name
> > 
> > 
> > Thomas,
> > 
> > Tried this yesterday, and then again today after I got your 
> > reply.  I keep
> > getting an Oracle error 
> > 
> > 		ORA-00923: FROM keyword not found where expected
> > 
> > Here is the snippet.....
> > 
> > 			ps = con.prepareStatement("SELECT DISTINCT
> > case_detail_1.case_id 'id', " +
> > 	
> > "f_get_param(case_detail_1.id, 'last_name') 'lastName', " +
> > 	
> > "f_get_param(case_detail_1.id, 'first_name') 'firstName', " +
> > 	
> > "f_get_param(case_detail_1.id, 'ssn') 'ssn', " +
> > 	
> > "f_get_param(case_detail_1.id, 'policy_type') 'policyType', " +
> > 	
> > "f_get_param(case_detail_1.id, 'dob') 'birthDate', " +
> > 	
> > "f_get_param(case_detail_1.id, 'quoteback') 'quotebackNumber', " +
> > 	
> > "case_detail_1.user_name 'userName', " +
> > 	
> > "cases_1.timestamp 'timeStamp', " +
> > 	
> > "case_detail_1.status 'status' " +
> > 							  "FROM
> > case_detail_1, cases_1 " +
> > 							  "WHERE
> > case_detail_1.case_id = cases_1.id AND " +
> > 	
> > "case_detail_1.appl_id = 'OE_WEB' " +
> > 							  	
> > whereClause
> > + 
> > 							  "ORDER BY
> > cases_1.timestamp");
> > 
> > I think I've got everything balanced, so I'm not sure why 
> > this doesn't work.
> > Any ideas?
> > 
> > Jerry
> > 
> > > -----Original Message-----
> > > From: Gideon, Thomas [mailto:Thomas.Gideon@B2eMarkets.com]
> > > Sent: Wednesday, October 09, 2002 11:10 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: [OT - BeanUtils.populate] 'Case' of property name
> > > 
> > > 
> > > Are you using quotes around your aliases in your SQL?  We 
> > > found the trick to
> > > getting Oracle to respect case was to quote the alias.  At 
> > > least this is
> > > true of version 8.1.x.
> > > 
> > > 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 5:02 PM
> > > > To: 'Struts Users Mailing List'
> > > > Subject: RE: [OT - BeanUtils.populate] 'Case' of property name
> > > > 
> > > > 
> > > > 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>
> > > > 
> > > 
> > > --
> > > 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>
> > 
> 
> --
> 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