ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris McMahon <cochran...@hotmail.com>
Subject RE: iBATIS and Batch
Date Fri, 29 Feb 2008 21:07:00 GMT
So you group things together by table?

Does the JDBC driver not let you batch update across tables without changing the order?



From: clinton.begin@gmail.com
To: user-java@ibatis.apache.org
Subject: RE: iBATIS and Batch
Date: Fri, 29 Feb 2008 11:53:39 -0700



















It batches based on the statement.  So given this example:

 

INSERT INTO author (id,username, password, email, bio) VALUES
(1,'jim','********','jim@ibatis.apache.org','');

INSERT INTO author (id,username, password, email, bio) VALUES
(2,'sally','********','sally@ibatis.apache.org',null);

 

INSERT INTO blog (id,author_id,title) VALUES (1,1,'Jim
Business');

INSERT INTO blog (id,author_id,title) VALUES (2,2,'Bally Slog');

 

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(1,1,'2007-12-05-00.00.00','Corn nuts','I think if I never smelled another corn
nut, it would be too soon...');

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(2,1,'2008-01-12-00.00.00','Paul Hogan on Toy Dogs','That''s not a dog. 
THAT''s a dog!');

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(3,2,'2007-12-05-00.00.00','Monster Trucks','I think monster trucks are
great...');

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(4,2,'2008-01-12-00.00.00','Tea Parties','A tea party is no place to hold a
business meeting...');

 

These would be executed with 3 batches.  If you mix up the
order...

 

INSERT INTO author (id,username, password, email, bio) VALUES
(1,'jim','********','jim@ibatis.apache.org','');

 

INSERT INTO blog (id,author_id,title) VALUES (1,1,'Jim
Business');

 

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(1,1,'2007-12-05-00.00.00','Corn nuts','I think if I never smelled another corn
nut, it would be too soon...');

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(2,1,'2008-01-12-00.00.00','Paul Hogan on Toy Dogs','That''s not a dog. 
THAT''s a dog!');

 

INSERT INTO author (id,username, password, email, bio) VALUES
(2,'sally','********','sally@ibatis.apache.org',null);

 

INSERT INTO blog (id,author_id,title) VALUES (2,2,'Bally Slog');

 

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(3,2,'2007-12-05-00.00.00','Monster Trucks','I think monster trucks are
great...');

INSERT INTO post (id,blog_id,created_on,subject,body) VALUES
(4,2,'2008-01-12-00.00.00','Tea Parties','A tea party is no place to hold a
business meeting...');

 

It would execute with 6 batches.

 

Doing it any other way would cause the statements to execute out
of order, which is a more serious concern and not correctable by the user of
the framework.

 

Clinton

 





From: Chris McMahon
[mailto:cochrane68@hotmail.com] 

Sent: February-29-08 11:43 AM

To: user-java@ibatis.apache.org

Subject: RE: iBATIS and Batch





 

We use the batch functionality
frequently.  How is iBATIS determining what is homogeneous and what is
heterogeneous?  We have a mix of both straight SQL updates and prepared
statement updates.













From: clinton.begin@gmail.com

To: user-java@ibatis.apache.org

Subject: RE: iBATIS and Batch

Date: Fri, 29 Feb 2008 08:58:43 -0700



Unfortunately no... that’s possibly something we can consider
for future versions.

 

The challenge is that some people have the exact opposite
problem.  They need the statements to maintain the order of
execution.  When initially deciding who to help, I decided that preserving
the order of execution was more important than performance.  I also
assumed that if you’re using a mixed order of heterogeneous statements, you
could probably find a way to order them by type and send them through to make
the most of batching.  Whereas the opposite wouldn’t be true, as if I
always just reordered the statements for the sake of performance – there would
be no way back.   I suppose we could support it as an option, but
before that I have to ask:

 

Can you reorder your statements?  If not, why not?

 

Clinton

 

 

 

 

 



From: chris.mccauley@gsa.gov
[mailto:chris.mccauley@gsa.gov] 

Sent: February-29-08 8:47 AM

To: user-java@ibatis.apache.org

Subject: iBATIS and Batch



 



Recently
we have been implementing batched SQL calls using iBatis through JDBC. 



IT
appears that iBatis will reorganize batch statements into homogenous calls and
treat them as separate batches.... 



The
problem is that is if you do not serially add the homogenous statements, each
'change' from homogeneity results in a separate batch... 



Does
this sound correct?  Is there something we can do to control the batching
of heterogeneous calls?








Thank
you, 

Christopher



 







Connect
and share in new ways with Windows Live. Get it now!







_________________________________________________________________
Helping your favorite cause is as easy as instant messaging. You IM, we give.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join
Mime
View raw message