ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trenton D. Adams" <tre...@athabascau.ca>
Subject update not working
Date Thu, 07 Aug 2008 21:32:07 GMT
Hi Guys.

I have a basic update like so...
  <update id="updateStudent" parameterClass="java.util.Map">
    UPDATE system.tmpk_charset
       SET spriden_last_name = #lastName#,
           spriden_first_name = #firstName#
     WHERE spriden_id = #studentID#
  </update>

I have a basic transaction manager like so, where the destination.url is in database.properties...
  <transactionManager type="JDBC" commitRequired="i set this to true or false with no affect">
    <dataSource type="SIMPLE">
      <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/>
      <property name="JDBC.ConnectionURL"
                value="${destination.url}"/>
      <property name="JDBC.Username" value="user"/>
      <property name="JDBC.Password" value="pass"/>
    </dataSource>
  </transactionManager>

I have code like so...
            List<Student> students = sourceMapper.queryForList("getStudents", null);

            Map parameters;
            parameters = new Hashtable();
            for (Student student: students)
            {
                parameters.clear();
                parameters.put("studentID", student.getStudentID());
                parameters.put("firstName", "Bob");
                parameters.put("lastName", "Bob");
                destinationMapper.startTransaction();
                destinationMapper.update("updateStudent", parameters);
                destinationMapper.commitTransaction();
                System.out.println("spriden_id: " + student.getStudentID());
                System.out.println("spriden_first_name: " + student.getFirstName());
                System.out.println("spriden_last_name: " + student.getLastName());
            }

And guess what, the students are not having their first and last names set to "Bob".  Why?
 FYI: If I try and insert a value to large for the column, it fails miserably (ORA-01401:
inserted value too large for column), so the update is obviously running, but why is it not
being committed?  Or, perhaps it is I who needs to be committed?

I would also like to use DBCP, but I'm going with SIMPLE because this wasn't working with
DBCP either.

I also tried putting transaction stuff around.

Thanks.

Trenton D. Adams
Systems Analyst/Web Software Engineer
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

__ 
    This communication is intended for the use of the recipient to whom it
    is addressed, and may contain confidential, personal, and or privileged
    information. Please contact us immediately if you are not the intended
    recipient of this communication, and do not copy, distribute, or take
    action relying on it. Any communications received in error, or
    subsequent reply, should be deleted or destroyed.
---

Mime
View raw message