ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mkhitaryan, Aram" <Aram.Mkhitar...@lycos-europe.com>
Subject RE: IBATIS Batch Support
Date Thu, 27 Jul 2006 10:44:42 GMT
Between start and execute Batch() methods you can execute only inserts and updates.
SqlMap every statement executes with PreparedStatements.

Use also startTransaction(), commitTransaction(), endTransaction() methods.
Only with this methods batch works normal.
 
Example:
try {
	sqlMap.startTransaction();
	sqlMap.startBtach()
	all inserts
         	sqlMap.executeBatch()
         	sqlMap.startBtach()
         	all updates
         	sqlMap.executeBatch()
	sqlMap.commitTransaction();
} finally {
	sqlMap.endTransaction();
}

Best,
Aram

-----Original Message-----
From: Sumanta Ghosh [mailto:sumanta.g@tcs.com] 
Sent: Thursday, July 27, 2006 3:21 PM
To: user-java@ibatis.apache.org
Subject: IBATIS Batch Support


Does IBATIS have Batch support for preparedstatements e.g. suppose I have got
4 statements, 2 inserts and 2 update. How should I call batch?
Option 1: 
         sqlMap.startBatch();
         all statements
         sqlMap.executeBatch()
Option 2:
         sqlMap.startBtach()
         all inserts
         sqlMap.executeBatch()
         sqlMap.startBtach()
         all updates
         sqlMap.executeBatch()
In my idea for option 1 you cannot use preparedstatement, have to use
statements.
Am I Correct? please confirm. 
-- 
View this message in context: http://www.nabble.com/IBATIS-Batch-Support-tf2008779.html#a5518529
Sent from the iBATIS - User - Java forum at Nabble.com.

Mime
View raw message