Announcement Announcement Module
Collapse
No announcement yet.
what does jdbcTemplate do for us? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • what does jdbcTemplate do for us?


    when I use JdbcDaoSupport, need I close the resultset,close
    the datasource connection everytime I execute some sql?
    need I add a transaction to every method in the class?

    what does jdbcTemplate do for us and what should we do when using it?

  • #2
    Did you read the documentation?

    Comment


    • #3
      No, you don't need to close the resultset, connection, etc. What JdbcTemplate does for you is provide various methods for accessing your database without having to worry about catching exceptions or closing your resources.

      Basically JdbcTemplate is the basis of straight JDBC in Spring.

      Comment


      • #4
        Originally posted by trisberg
        Did you read the documentation?
        thank you.

        well,I now have read that.there is no need to close the resultset or the connection,but a kind of situation confused me.
        I am using JdbcDaoSupport to access my db,which is wrapped with c3p0 datasource;I was trying to invoke a method in my DAO(include result operations) while iterating a resultset in another method.then c3p0 indicated that there's a deadlock! after I added xml-define transaction to these methods,the deadlock disappeared.how to explain this?

        also deadlock hints appear while I am using hibernate in an other program.
        I cannot find why this keeps happening(I add transaction per request in
        the filter in this program using hibernate).

        Comment


        • #5
          Could you post the method which invokes the JdbcTemplate, including any classes used to read the resultset?

          Comment

          Working...
          X