commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: DbUtils question
Date Wed, 03 Dec 2003 17:14:26 GMT

--- Emerson Cargnin <emerson@tre-sc.gov.br> wrote:
> It looks that my problem is with oracle number fields. WHat's the 
> mapping for bean and database types?

DbUtils 1.0 performs a very simple mapping: If the column type matches the
bean type exactly, the setter will be called.  We have added an
enhancement to be released with 1.1 that performs a more useful mapping. 
We will also make changes to BasicRowProcessor to make customized mappings
easier to implement.

Also see the javadoc:
http://jakarta.apache.org/commons/dbutils/apidocs/org/apache/commons/dbutils/BasicRowProcessor.html#toBean(java.sql.ResultSet,%20java.lang.Class)

> 
> As a suggestion, for the subject of naming mappings, dbutils could try 
> to map getAttName bean method to att_name database field.

DbUtils will not perform this kind of custom mapping.  You can either use
an SQL "AS" or write a custom RowProcessor implementation.

David

> 
> David Graham wrote:
> > --- Emerson Cargnin <emerson@tre-sc.gov.br> wrote:
> > 
> >>I'm giving my first steps into dbutils, and i'd like to make a
> question,
> >>
> >>since the docs are still  small:
> >>
> >>What's the mapping from the db field names and the get/set properties
> of
> >>
> >>my bean (the one sent to the sqlrunner).
> >>
> >>an example :
> >>
> >>if I have a sql command
> >>select * from mytable
> >>
> >>my table has two fields :
> >>
> >>id
> >>id_othertable
> >>
> >>What's are the allowed get/set mapping to get the bean with all the 
> >>properties of the resultset.
> >>
> >>it can translate from id_company to setCompany ?? or I have to use the
> 
> >>'as', modifying all the sql's?
> > 
> > 
> > You should use an SQL "AS" to change the column names to match your
> bean
> > property names.  Your id column would call setId() on your bean.  I'm
> not
> > sure about id_othertable because it contains an underscore but it
> should
> > call setId_othertable.
> > 
> > David
> > 
> > 
> >>Anyone could show me some complete examples???
> >>
> >>Thanks and congratulation for this excellent tool.
> >>
> >>
> >>-- 
> >>Emerson Cargnin
> >>Analista de Sistemas
> >>Setor de Desenvolvimento de Sistemas - TRE-SC
> >>tel : (048) - 251-3700 - Ramal 3181
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >>
> > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Emerson Cargnin
> Analista de Sistemas
> Setor de Desenvolvimento de Sistemas - TRE-SC
> tel : (048) - 251-3700 - Ramal 3181
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


Mime
View raw message