Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 46073 invoked from network); 19 Dec 2004 01:15:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 19 Dec 2004 01:15:38 -0000 Received: (qmail 19846 invoked by uid 500); 19 Dec 2004 01:15:36 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 19375 invoked by uid 500); 19 Dec 2004 01:15:35 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 19361 invoked by uid 500); 19 Dec 2004 01:15:35 -0000 Received: (qmail 19357 invoked by uid 99); 19 Dec 2004 01:15:35 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 18 Dec 2004 17:15:34 -0800 Received: (qmail 46017 invoked by uid 1581); 19 Dec 2004 01:15:33 -0000 Date: 19 Dec 2004 01:15:33 -0000 Message-ID: <20041219011533.46016.qmail@minotaur.apache.org> From: dgraham@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/dbutils/xdocs examples.xml X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N dgraham 2004/12/18 17:15:33 Modified: dbutils/xdocs examples.xml Log: Added tips for mapping strange column names to bean properties. PR: 32414 Revision Changes Path 1.7 +20 -0 jakarta-commons/dbutils/xdocs/examples.xml Index: examples.xml =================================================================== RCS file: /home/cvs/jakarta-commons/dbutils/xdocs/examples.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- examples.xml 19 Mar 2004 00:25:39 -0000 1.6 +++ examples.xml 19 Dec 2004 01:15:33 -0000 1.7 @@ -149,6 +149,26 @@ your application. The provided implementation delegates datatype conversion to the JDBC driver.

+

+BeanProcessor maps columns to bean properties as documented in the +BeanProcessor.toBean() javadoc. +Column names must match the bean's property names case insensitively. +For example, the firstname column would be stored in the bean +by calling its setFirstName() method. However, many database +column names include characters that either can't be used or are not typically +used in Java method names. You can do one of the following to map +these columns to bean properties: +

    +
  1. + Alias the column names in the SQL so they match the Java names: + select social_sec# as socialSecurityNumber from person +
  2. +
  3. + Subclass BeanProcessor and override the mapColumnsToProperties() + method to strip out the offending characters. +
  4. +
+

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