--- "Jos�_Fortunato_H._Tom�s" <[EMAIL PROTECTED]> wrote:
> I have the following problem:
> Bean setter for an Oracle DB table's collumn of type NUMBER isn't
> called.
>
> To parcially solve I had to use to_char SQL directive:
> --->
> QueryRunner run = new QueryRunner(
> GcfServiceLocator.getInstance().getDataSourceForGCF() );
> BeanListHandler bh = new BeanListHandler(
> CustomerValueObject.class );
> Object[] args = {( "%" + name + "%" ).replaceAll( "\\s", "%"
>
> ).replaceAll( "%{2,}", "%" )};
> query = "select" +
> " to_char(CUSTOMER_ID) customerId" +
> ", CUSTOMER_NAME name" +
> ", BILL_CYCLE billCycle" +
> ", to_char(CUSTOMER_TYPE) customerType" +
> ", STATUS state" +
> ", GTP_FLAG gtpFlag" +
> ", CREATE_DATE createDate" +
> ", CREATED_BY createdBy" +
> ", MODIFICATION_DATE modificationDate" +
> ", MODIFIED_BY modifiedBy" +
> " from CUSTOMER" +
> " where" +
> " CUSTOMER_NAME LIKE ?1"
> ;
> logger.debug( "getCustomerListByName(" + query + ")" );
> ret = (ArrayList)run.query(
> query
> , args
> , bh
> );
> <---
First, do not cross post messages to commons-dev and commons-user and do
not copy individuals on the message. I received this message 3 times!
This should have only been posted to commons-user.
Do not cast the result from run.query() to an ArrayList; BeanListHandler's
API states that a List is returned and we could change it to a different
implementation at any time.
>
> I looked into the source, but for lack of time I could't found the
> correct place that maps props types and collunms between setters for
> lookup method by reflection.
BasicRowProcessor is the class to look at. It's javadoc says how it maps
columns to properties:
http://jakarta.apache.org/commons/dbutils/apidocs/org/apache/commons/dbutils/BasicRowProcessor.html#toBean(java.sql.ResultSet,%20java.lang.Class)
>
> Is there a known issue ? What can I do?
> Is there any code that I can aplly?
> Or can you give-me an indication into the source so I contribute fastly?
You have a couple of options:
1. Implement your own RowProcessor
2. Have the BasicRowProcessor set all of the properties it can and you
set the rest manually.
FYI, there is discussion on commons-dev about a new interface that allows
specialized type conversion.
David
>
> Thanks!
> --
>
> __________________________________________________
>
> Jos� Fortunato Tom�s
>
> *Mediacapital** Telecomunica��es - IOL*
>
> Rua M�rio Castelhano n� 40
>
> 2749-502 BARCARENA
>
>
>
> Ext.: 12733
>
> Telef.: 21 434 59 33
>
> Fax.: 21 434 63 88
>
>
>
>
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]