You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Brent Ryan <br...@blackboard.com> on 2006/02/09 22:23:43 UTC

iBatis Conversion of java Type String to Numeric database field

If I have a java bean that contains only String data types, is there a
way to have iBatis insert/update rows in the database that have a data
type of 'Numeric'?
 
For Example... I read in a string of data from a text file, create my
bean, then call my iBatis service to insert the row of data into the
database.  However, the database has a numeric data type for some of the
fields.  Can iBatis handle this?  I don't want my bean to have int, Date
or other data types because then I have to figure that out during the
read of this text file.  I just want to treat everything as a String.
 
I know that if you do this in Hibernate that it knows how to insert the
String into a numeric data field.  However, Hibernates performance is
bad when I'm trying to insert 1 million rows of data into a single table
so I can't use it.  I need to use straight JDBC or iBatis possibly....
 
Thanks,
Brent


BbWorld '06
New Client-Centered Program, Peers Aplenty, Party on Deck
San Diego, CA February 28-March 2, 2006
Register today! Visit: http://www.blackboard.com/company/events/bbworld/ to learn more.

This e-mail is intended only for the personal and confidential use of the recipient(s) named above. 
It may include Blackboard confidential and proprietary information, and is not for redistribution.



Re: iBatis Conversion of java Type String to Numeric database field

Posted by Larry Meadors <lm...@apache.org>.
If you are updating a million records...don't use iBATIS. If you can
coerce the native loaders of your databases to read the file, do that.

I recently had to do a similar exercise: inserting / updating 200,000+
rows of data from a text file into an Oracle database. I ended up
using a stored procedure with a single connection committing every 100
iterations or so. Even using iBATIS to call the procedure (when you do
it that many times) is enough that you'll feel it.

I was getting about 50 rows/second with iBATIS, and got that up to
about 2,000 rows/second with straight jdbc. Looking at that, you might
think iBATIS is slow - but we are talking about a difference of less
than 20ms per operation. It is just that in this case, the number of
iterations made an insignificant amount of time more significant

Larry


On 2/9/06, Brent Ryan <br...@blackboard.com> wrote:
>
> If I have a java bean that contains only String data types, is there a way
> to have iBatis insert/update rows in the database that have a data type of
> 'Numeric'?
>
> For Example... I read in a string of data from a text file, create my bean,
> then call my iBatis service to insert the row of data into the database.
> However, the database has a numeric data type for some of the fields.  Can
> iBatis handle this?  I don't want my bean to have int, Date or other data
> types because then I have to figure that out during the read of this text
> file.  I just want to treat everything as a String.
>
> I know that if you do this in Hibernate that it knows how to insert the
> String into a numeric data field.  However, Hibernates performance is bad
> when I'm trying to insert 1 million rows of data into a single table so I
> can't use it.  I need to use straight JDBC or iBatis possibly....

RE: iBatis Conversion of java Type String to Numeric database field

Posted by Meindert <me...@pastelebusiness.com>.
Hi Ryan,

 

Sorry for replying without answering your question, but it sounds to me that
the validation of the text file should be done in your service layer, and
that the service layer should populate your data beans what is a reflection
of your tables.

 

MEINDERT HOVING



   _____  

From: Brent Ryan [mailto:bryan@blackboard.com] 
Sent: 09 February 2006 11:24 PM
To: user-java@ibatis.apache.org
Subject: iBatis Conversion of java Type String to Numeric database field

 

If I have a java bean that contains only String data types, is there a way
to have iBatis insert/update rows in the database that have a data type of
'Numeric'?

 

For Example... I read in a string of data from a text file, create my bean,
then call my iBatis service to insert the row of data into the database.
However, the database has a numeric data type for some of the fields.  Can
iBatis handle this?  I don't want my bean to have int, Date or other data
types because then I have to figure that out during the read of this text
file.  I just want to treat everything as a String.

 

I know that if you do this in Hibernate that it knows how to insert the
String into a numeric data field.  However, Hibernates performance is bad
when I'm trying to insert 1 million rows of data into a single table so I
can't use it.  I need to use straight JDBC or iBatis possibly....

 

Thanks,

Brent

BbWorld '06

New Client-Centered Program, Peers Aplenty, Party on Deck

San Diego, CA February 28-March 2, 2006

Register today! Visit: HYPERLINK
"http://www.blackboard.com/company/events/bbworld/"http://www.blackboard.com
/company/events/bbworld/ to learn more.

This e-mail is intended only for the personal and confidential use of the
recipient(s) named above. 
It may include Blackboard confidential and proprietary information, and is
not for redistribution.



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 09/02/2006



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 09/02/2006