Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6786463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:14:53+00:00 2026-05-26T17:14:53+00:00

I have a problem using iBatis as database framework for a web application. I

  • 0

I have a problem using iBatis as database framework for a web application. I want to manually commit the transaction after a couple of inserts, but iBatis auto commits it after every insert. How can I prevent that?

Here is my SqlMapConfig.xml file content:

<sqlMapConfig>

<settings enhancementEnabled="true"
    errorTracingEnabled="true"
    useStatementNamespaces="false" />

<transactionManager type="JDBC" commitRequired="false" >
    <dataSource type="JNDI">
        <property name="DataSource"
            value="java:/comp/env/jdbc/MY_DB" /> 
    </dataSource>
</transactionManager>

<sqlMap resource="com/my/common/Common.xml" />

</sqlMapConfig>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:14:54+00:00Added an answer on May 26, 2026 at 5:14 pm

    I’m also learning Ibatis/MyBatis and gradually getting my grips into it. I cannot tell you about all the different attributes of the sqlMapConfig as I am uncertain on some of the settings but I take you want several inserts to be included in a single transaction? Similar to a batch update, wrap the batch in a single transaction. This example is based on IBatis 2.3.4

    try {
            sqlMap.startTransaction();
            sqlMap.startBatch();
            for (final ObjectXXXDTO objectReference1 : GenericObjectList) {
                sqlMap.insert("createExample1", objectReference1);
            }
            sqlMap.insert("createExample2", otherReference2);
            sqlMap.insert("createExample3", otherReference3);
            sqlMap.executeBatch();
            sqlMap.commitTransaction();
        } catch (final SQLException e) {
            throw new XXXException(e);
        } finally {
            try {
                sqlMap.endTransaction();
            } catch (SQLException e) {
                throw new XXXException(e);
            }
        }
    

    However note that whenever you are using a batched set of statements the database generated keys will not be generated until you have called the executeBatch() method. This means if you are using selectKey to update your objects with the generated keys they will return null. If you have any object that requires the newly generated key as part of another insert then you can have this insert or update before the startBatch().

    Again I’m uncertain if this is the approach you are after but I thought of posting it anyways. Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem using the SSIS. I try to import data from database
i am coming back because i still have problem using JodaTime. After the previous
Environment: The application is using Spring Framework 2.5.6.SEC01 and iBatis 2.3.4.726. It is MVC
i have problem using camera in my Android application i have a form for
I have problem with using next two properties together in one Air application, I
i have problem with using bitmap in console application in c#. I included system.drawing
I have a problem using CAB Framework. I created some GUI User control interfaces
I have problem while using jquery maskedinput with asp.net textbox. I have a check
I have a problem using the Java search function in Eclipse on a particular
I have a problem using Linq to NHibernate to load an object and eagerly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.