Announcement Announcement Module
No announcement yet.
Validation strategy ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation strategy ?


    I'm new to Spring, using a website developed by a colleague. I really enjoy it and I've good fun. However, I currently have a question regarding the way the validation works.

    Indeed, I would like to know when the "commit" are done in my SQL statements. After a few searches (for example on commit using CTRL-H in my Eclipse), I just found this piece of information in the spring-database.xml :

    <!-- datasource creation -->
    <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <!--property name="defaultAutoCommit"><value>false</value></property-->
    <!-- Transaction manager -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource"><ref local="datasource"/></property>

    So my guess is : nothing is done on the framework side, something has to set up the database in a "autocommit" mode.

    Is it right ? Do you have more clue ?

    Thanks in advance

  • #2
    You can moniter commits at db level with a tool like IrontrackSQL or through logging. Auto-commit has other meaning and it's recommended to set it to false when working with transactions.
    When you are working with a database you'll use most of the times a datasource/connection pool library which offers a lot of properties for you to tweak and the possibility to customize the database general properties for your local access.
    In short you can play with autocommit through the datasource settings - in this case commonsDBCP; take a look at the javadocs and you'll see other settings as well.


    • #3
      Thanks for your answer.

      I did read the Javadoc for the commonsDBCP but I must admit I didn't find a comprensible explanation of this property. I'm quite new in the topic, this may explain that

      I'll double check the javadoc but the one for commonsDBCP seemed, to me, no as good as others ones (like the one for the JDSK).


      • #4
        No problem - hopefully this forum can assist you. Not all projects have good documentation as you already seen - instead of commons-dbcp you can try c3p0.
        It would be a good exercise for a beginner to set up c3p0 through Spring (you can find a solution as answer in the spring samples).