Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 80485 invoked from network); 1 Mar 2008 02:10:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Mar 2008 02:10:49 -0000 Received: (qmail 58243 invoked by uid 500); 1 Mar 2008 02:10:43 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 58223 invoked by uid 500); 1 Mar 2008 02:10:43 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 58212 invoked by uid 99); 1 Mar 2008 02:10:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 18:10:42 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cochrane68@hotmail.com designates 65.54.246.176 as permitted sender) Received: from [65.54.246.176] (HELO bay0-omc2-s40.bay0.hotmail.com) (65.54.246.176) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Mar 2008 02:10:05 +0000 Received: from BAY103-W37 ([65.54.174.137]) by bay0-omc2-s40.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 29 Feb 2008 18:10:15 -0800 Message-ID: Content-Type: multipart/alternative; boundary="_6af0d478-a7d7-4e9a-b152-e013dfb0d84f_" X-Originating-IP: [68.100.225.12] From: Chris McMahon To: Subject: RE: iBATIS and Batch Date: Sat, 1 Mar 2008 02:10:14 +0000 Importance: Normal In-Reply-To: <47c879c9.06538c0a.422c.0721@mx.google.com> References: <47c82bca.06538c0a.422c.ffff9b7e@mx.google.com> <47c854cb.24b48c0a.5e68.fffff00b@mx.google.com> <47c879c9.06538c0a.422c.0721@mx.google.com> MIME-Version: 1.0 X-OriginalArrivalTime: 01 Mar 2008 02:10:15.0317 (UTC) FILETIME=[638A7C50:01C87B41] X-Virus-Checked: Checked by ClamAV on apache.org --_6af0d478-a7d7-4e9a-b152-e013dfb0d84f_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable This article: =20 http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html suggests that you can pass heterogeneous SQL statements to the database usi= ng the JDBC batch functionality. However, it was less clear that you could= do this with PreparedStatements. Does iBATIS always use PreparedStatements even if there are no arguments to= pass in? In the examples you gave below, you didn't use arguments in your= SQL statements. From: clinton.begin@gmail.com To: user-java@ibatis.apache.org Subject: RE: iBATIS and Batch Date: Fri, 29 Feb 2008 14:31:28 -0700 =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= >> So=0A= you group things together by table? =0A= =0A= =0A= =0A= iBATIS doesn=92t know what a table is. It groups them by (Prepared)=0A= SQL Statement.=0A= =0A= =0A= =0A= >> Does=0A= the JDBC driver not let you batch update across tables without changing the= =0A= order?=0A= =0A= =0A= =0A= The batching features of JDBC are at the statement level. We=0A= maintain the order of the statements, but otherwise it=92s exactly how the = JDBC=0A= documentation describes =96 which is quite vague and more up to the JDBC dr= iver=0A= than anything. =0A= =0A= =0A= =0A= I believe it=92s as efficient as it can be, without losing the=0A= order of the statements.=0A= =0A= =0A= =0A= Clinton=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= From: Chris McMahon=0A= [mailto:cochrane68@hotmail.com]=20 =0A= Sent: February-29-08 2:07 PM =0A= To: user-java@ibatis.apache.org =0A= Subject: RE: iBATIS and Batch=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= So=0A= you group things together by table? =0A= =0A= Does the JDBC driver not let you batch update across tables without changin= g=0A= the order?=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= From: clinton.begin@gmail.com =0A= To: user-java@ibatis.apache.org =0A= Subject: RE: iBATIS and Batch =0A= Date: Fri, 29 Feb 2008 11:53:39 -0700=0A= =0A= =0A= =0A= It batches based on the statement. So given this example:=0A= =0A= =0A= =0A= INSERT INTO author (id,username, password, email, bio) VALUES=0A= (1,'jim','********','jim@ibatis.apache.org','');=0A= =0A= INSERT INTO author (id,username, password, email, bio) VALUES=0A= (2,'sally','********','sally@ibatis.apache.org',null);=0A= =0A= =0A= =0A= INSERT INTO blog (id,author_id,title) VALUES (1,1,'Jim=0A= Business');=0A= =0A= INSERT INTO blog (id,author_id,title) VALUES (2,2,'Bally Slog');=0A= =0A= =0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (1,1,'2007-12-05-00.00.00','Corn nuts','I think if I never smelled another = corn=0A= nut, it would be too soon...');=0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (2,1,'2008-01-12-00.00.00','Paul Hogan on Toy Dogs','That''s not a dog. =0A= THAT''s a dog!');=0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (3,2,'2007-12-05-00.00.00','Monster Trucks','I think monster trucks are=0A= great...');=0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (4,2,'2008-01-12-00.00.00','Tea Parties','A tea party is no place to hold a= =0A= business meeting...');=0A= =0A= =0A= =0A= These would be executed with 3 batches. If you mix up the=0A= order...=0A= =0A= =0A= =0A= INSERT INTO author (id,username, password, email, bio) VALUES=0A= (1,'jim','********','jim@ibatis.apache.org','');=0A= =0A= =0A= =0A= INSERT INTO blog (id,author_id,title) VALUES (1,1,'Jim=0A= Business');=0A= =0A= =0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (1,1,'2007-12-05-00.00.00','Corn nuts','I think if I never smelled another = corn=0A= nut, it would be too soon...');=0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (2,1,'2008-01-12-00.00.00','Paul Hogan on Toy Dogs','That''s not a dog. =0A= THAT''s a dog!');=0A= =0A= =0A= =0A= INSERT INTO author (id,username, password, email, bio) VALUES=0A= (2,'sally','********','sally@ibatis.apache.org',null);=0A= =0A= =0A= =0A= INSERT INTO blog (id,author_id,title) VALUES (2,2,'Bally Slog');=0A= =0A= =0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (3,2,'2007-12-05-00.00.00','Monster Trucks','I think monster trucks are=0A= great...');=0A= =0A= INSERT INTO post (id,blog_id,created_on,subject,body) VALUES=0A= (4,2,'2008-01-12-00.00.00','Tea Parties','A tea party is no place to hold a= =0A= business meeting...');=0A= =0A= =0A= =0A= It would execute with 6 batches.=0A= =0A= =0A= =0A= Doing it any other way would cause the statements to execute out=0A= of order, which is a more serious concern and not correctable by the user o= f=0A= the framework.=0A= =0A= =0A= =0A= Clinton=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= From: Chris McMahon=0A= [mailto:cochrane68@hotmail.com]=20 =0A= Sent: February-29-08 11:43 AM =0A= To: user-java@ibatis.apache.org =0A= Subject: RE: iBATIS and Batch=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= We use the batch functionality=0A= frequently. How is iBATIS determining what is homogeneous and what is hete= rogeneous? =0A= We have a mix of both straight SQL updates and prepared statement updates.= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= From: clinton.begin@gmail.com =0A= To: user-java@ibatis.apache.org =0A= Subject: RE: iBATIS and Batch =0A= Date: Fri, 29 Feb 2008 08:58:43 -0700=0A= =0A= =0A= =0A= Unfortunately no... that=92s possibly something we can consider=0A= for future versions.=0A= =0A= =0A= =0A= The challenge is that some people have the exact opposite=0A= problem. They need the statements to maintain the order of=0A= execution. When initially deciding who to help, I decided that preserving= =0A= the order of execution was more important than performance. I also=0A= assumed that if you=92re using a mixed order of heterogeneous statements, y= ou=0A= could probably find a way to order them by type and send them through to ma= ke=0A= the most of batching. Whereas the opposite wouldn=92t be true, as if I=0A= always just reordered the statements for the sake of performance =96 there = would=0A= be no way back. I suppose we could support it as an option, but=0A= before that I have to ask:=0A= =0A= =0A= =0A= Can you reorder your statements? If not, why not?=0A= =0A= =0A= =0A= Clinton=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= From: chris.mccauley@gsa.gov=0A= [mailto:chris.mccauley@gsa.gov]=20 =0A= Sent: February-29-08 8:47 AM =0A= To: user-java@ibatis.apache.org =0A= Subject: iBATIS and Batch=0A= =0A= =0A= =0A= =0A= =0A= =0A= Recently=0A= we have been implementing batched SQL calls using iBatis through JDBC.=20 =0A= =0A= IT appears=0A= that iBatis will reorganize batch statements into homogenous calls and trea= t=0A= them as separate batches....=20 =0A= =0A= The=0A= problem is that is if you do not serially add the homogenous statements, ea= ch=0A= 'change' from homogeneity results in a separate batch...=20 =0A= =0A= Does=0A= this sound correct? Is there something we can do to control the batching= =0A= of heterogeneous calls?=0A= =0A= =0A= =0A= =0A= Thank=0A= you,=20 =0A= Christopher=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= Connect=0A= and share in new ways with Windows Live. Get it now!=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= Helping=0A= your favorite cause is as easy as instant messaging. You IM, we give. Learn= more.=0A= =0A= =0A= =0A= =0A= =0A= =0A= _________________________________________________________________ Climb to the top of the charts!=A0Play the word scramble challenge with sta= r power. http://club.live.com/star_shuffle.aspx?icid=3Dstarshuffle_wlmailtextlink_ja= n= --_6af0d478-a7d7-4e9a-b152-e013dfb0d84f_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
This article:&nb= sp;

    http://java.sun.com/j2se/1.3/docs/guide/jdbc= /spec2/jdbc2.1.frame6.html

suggests that you can pass heterogeneous = SQL statements to the database using the JDBC batch functionality.  Ho= wever, it was less clear that you could do this with PreparedStatements.
Does iBATIS always use PreparedStatements even if there are no argumen= ts to pass in?  In the examples you gave below, you didn't use argumen= ts in your SQL statements.




From: clinton.begin@gmail.com
To: user-java@ibatis.apache.or= g
Subject: RE: iBATIS and Batch
Date: Fri, 29 Feb 2008 14:31:28 -0700=

=0A= =0A= =0A= = =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A=
=0A= =0A=

>> So=0A= you group things together by table?
=0A=
=0A=

=0A= =0A=

iBATIS doesn=92t know what a = table is.  It groups them by (Prepared)=0A= SQL Statement.

=0A= =0A=

 

=0A= =0A=

>> Does=0A= the JDBC driver not let you batch update across tables without changing the= =0A= order?

=0A= =0A=

 

=0A= =0A=

The batching features of JDBC= are at the statement level.  We=0A= maintain the order of the statements, but otherwise it=92s exactly how the = JDBC=0A= documentation describes =96 which is quite vague and more up to the JDBC dr= iver=0A= than anything. 

=0A= =0A=

 

=0A= =0A=

I believe it=92s as efficient= as it can be, without losing the=0A= order of the statements.

=0A= =0A=

 

=0A= =0A=

Clinton

=0A= =0A=

 

=0A= =0A=
=0A= =0A=
=0A= =0A=

From: Chris McMah= on=0A= [mailto:cochrane68@hotmail.com]
=0A= Sent: February-29-08 2:07 PM
=0A= To: user-java@ibatis.apache.org
=0A= Subject: RE: iBATIS and Batch

=0A= =0A=
=0A= =0A=
=0A= =0A=

 

=0A= =0A=

So=0A= you group things together by table?
=0A=
=0A= Does the JDBC driver not let you batch update across tables without changin= g=0A= the order?

=0A= =0A=


=0A=
=0A=

=0A= =0A=
= =0A= =0A=
= =0A= =0A=
=0A= =0A=

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

=0A= =0A=
=0A= =0A=

It batches based on the state= ment.  So given this example:

=0A= =0A=

 

=0A= =0A=

INSERT INTO author (id,userna= me, password, email, bio) VALUES=0A= (1,'jim','********','jim@ibatis.apache.org','');

=0A= =0A=

INSERT INTO author (id,userna= me, password, email, bio) VALUES=0A= (2,'sally','********','sally@ibatis.apache.org',null);

=0A= =0A=

 

=0A= =0A=

INSERT INTO blog (id,author_i= d,title) VALUES (1,1,'Jim=0A= Business');

=0A= =0A=

INSERT INTO blog (id,author_i= d,title) VALUES (2,2,'Bally Slog');

=0A= =0A=

 

=0A= =0A=

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

=0A= =0A=

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

=0A= =0A=

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

=0A= =0A=

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

=0A= =0A=

 

=0A= =0A=

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

=0A= =0A=

 

=0A= =0A=

INSERT INTO author (id,userna= me, password, email, bio) VALUES=0A= (1,'jim','********','jim@ibatis.apache.org','');

=0A= =0A=

 

=0A= =0A=

INSERT INTO blog (id,author_i= d,title) VALUES (1,1,'Jim=0A= Business');

=0A= =0A=

 

=0A= =0A=

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

=0A= =0A=

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

=0A= =0A=

 

=0A= =0A=

INSERT INTO author (id,userna= me, password, email, bio) VALUES=0A= (2,'sally','********','sally@ibatis.apache.org',null);

=0A= =0A=

 

=0A= =0A=

INSERT INTO blog (id,author_i= d,title) VALUES (2,2,'Bally Slog');

=0A= =0A=

 

=0A= =0A=

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

=0A= =0A=

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

=0A= =0A=

 

=0A= =0A=

It would execute with 6 batch= es. 

=0A= =0A=

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

=0A= =0A=

 

=0A= =0A=

Clinton

=0A= =0A=

 

=0A= =0A=
=0A= =0A=
=0A= =0A=

From: Chris McMah= on=0A= [mailto:cochrane68@hotmail.com]
=0A= Sent: February-29-08 11:43 AM
=0A= To: user-java@ibatis.apache.org
=0A= Subject: RE: iBATIS and Batch

=0A= =0A=
=0A= =0A=
=0A= =0A=

 

=0A= =0A=

We use the batch functio= nality=0A= frequently.  How is iBATIS determining what is homogeneous and what is= heterogeneous? =0A= We have a mix of both straight SQL updates and prepared statement updates.<= /span>

=0A= =0A=

 

=0A= =0A=
= =0A= =0A=
=0A= =0A=
=0A= =0A=

From: clinton.begin@gmai= l.com
=0A= To: user-java@ibatis.apache.org
=0A= Subject: RE: iBATIS and Batch
=0A= Date: Fri, 29 Feb 2008 08:58:43 -0700

=0A= =0A=
=0A= =0A=

Unfortunately no... that=92s = possibly something we can consider=0A= for future versions.

=0A= =0A=

 

=0A= =0A=

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

=0A= =0A=

 

=0A= =0A=

Can you reorder your statemen= ts?  If not, why not?

=0A= =0A=

 

=0A= =0A=

Clinton

=0A= =0A=

 

=0A= =0A=

 

=0A= =0A=

 

=0A= =0A=

 

=0A= =0A=

 

=0A= =0A=
=0A= =0A=

From: chris.mccau= ley@gsa.gov=0A= [mailto:chris.mccauley@gsa.gov]
=0A= Sent: February-29-08 8:47 AM
=0A= To: user-java@ibatis.apache.org
=0A= Subject: iBATIS and Batch

=0A= =0A=
=0A= =0A=

 

=0A= =0A=


=0A=
= Recently=0A= we have been implementing batched SQL calls using iBatis through JDBC. =0A=
=0A=
= IT appears=0A= that iBatis will reorganize batch statements into homogenous calls and trea= t=0A= them as separate batches....
=0A=
=0A=
= The=0A= problem is that is if you do not serially add the homogenous statements, ea= ch=0A= 'change' from homogeneity results in a separate batch...
=0A=
=0A=
= Does=0A= this sound correct?  Is there something we can do to control the batch= ing=0A= of heterogeneous calls?=0A=
=0A=
=0A=
=0A=
=0A=
= Thank=0A= you,
=0A= Christopher

=0A= =0A=
=0A= =0A=

 

=0A= =0A=
= =0A= =0A=
=0A= =0A=
=0A= =0A=

Connect=0A= and share in new ways with Windows Live. G= et it now!

=0A= =0A=
=0A= =0A=

 

=0A= =0A=
= =0A= =0A=
=0A= =0A=
=0A= =0A=

Helping=0A= your favorite cause is as easy as instant messaging. You IM, we give. = Learn more.

=0A= =0A=
=0A= =0A= =0A= =0A= =0A=


Climb to the top of the charts!=A0Play the word sc= ramble challenge with star power. Play now! = --_6af0d478-a7d7-4e9a-b152-e013dfb0d84f_--