Results 1 to 2 of 2

Thread: JdbcTemplate not updating the database

  1. #1
    Join Date
    Nov 2009
    Posts
    5

    Default JdbcTemplate not updating the database

    Hi,

    I am not sure why a JdbcTemplate is not updating the database. Everything is fine:
    *) JdbcTemplate is not null
    *) int x =jdbcTemplate.update(query, new Object{})...
    x value is 1 in debug mode, I have no clue why it is not updating the value..

    no erorrs, the test case runs fine.


    Below is the code snippet:

    public class ServiceDAOImpl extends JdbcDaoSupport implements ServiceDAO {

    int x =getJdbcTemplate().update(UPDATE_STATUS, new Object[] {Integer.valueOf(Id)});

    where UPDATE_STATUS is the string "UPDATE PARTY SET AV_ID = 1000 WHERE PK_ID = ? "

    the frustrating part is in the test case x is 1, and it runs fine but the AV_ID is not 1000 in the database...

    no errors nothing...
    the test-app-context goes like this..


    <bean id="serviceDAO" class="blah.....ServiceDAOImpl">
    <property name="dataSource"><ref local="dataSource" /></property>
    </bean>

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Use [ code][/code ] tags when posting code...

    Use transactions, update/delete/insert without transactions are useless. So configure a transactionmanager and properly configure your tx management.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •