Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-734

IBATIS is not adding the single quotes for String java data type in an UPDATE statement from a pojo as parameterType

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Not A Problem
    • 3.0 Beta 4, 3.0 Beta 9
    • 3.0 Beta 9
    • Core
    • None
    • Ibatis jar: ibatis-3-core-3.0.0.227.jar
      JDK: java version "1.6.0_14"
      Application Server: JBoss 5.10
      BBDD: Informix 9
      OS: Ubuntu 9.10 64bits

    Description

      I have a simple POJO:

      public class Participante implements java.io.Serializable{
      private Integer nroPartic;
      private String cveTipoPartic;
      private String codPartic;
      private String nomPartic;
      private String nemoPartic;
      private String codAge;
      private String email;
      // Gettter y Setters ...
      }

      My mapped update is:

      <update id="actualizaParticipante" parameterType="patito.vo.Participante">
      UPDATE participante
      SET
      cvetipopartic = ${cveTipoPartic},
      codpartic = ${codPartic},
      nompartic = ${nomPartic},
      nemopartic = ${nemoPartic},
      codage = ${codAge},
      email = ${email}
      WHERE
      nroPartic = ${nroPartic}
      </update>

      Code for execute the update is:

      public void actualizaParticipante(Participante participante) {
      SqlSession sqlSession = sqlSessionFactory.openSession();
      try

      { sqlSession.update(SubastaDAO.class.getName() +".actualizaParticipante", participante); }

      finally

      { sqlSession.close(); }

      }

      But when the app run throw the following exception:

          1. Error updating database. Cause: java.sql.SQLException: A syntax error has occurred.
          2. The error may exist in patito/dao/subasta/SubastaDAO.xml
          3. The error may involve patito.dao.subasta.SubastaDAO.actualizaParticipante
          4. The error occurred while executing an update
          5. SQL: UPDATE participante SET cvetipopartic = X, codpartic = 1111 , nompartic = FONDO XXXXXXXXX XXXXXXXXX (XXXX) , nemopartic = FDO.RAL , codage = 1234, email = tabata@mail.com WHERE nroPartic = 5432
          6. Cause: java.sql.SQLException: A syntax error has occurred.

      Formatting the SQL:

      UPDATE participante
      SET
      cvetipopartic = X,
      codpartic = 1111 ,
      nompartic = FONDO XXXXXXXXX XXXXXXXXX (XXXX) ,
      nemopartic = FDO.RAL ,
      codage = 1234,
      email = tabata@mail.com
      WHERE nroPartic = 5432

      <strong> IBATIS is not adding the single quotes for String java data type. <strong>

      Attachments

        Activity

          People

            Unassigned Unassigned
            ernestomar Ernesto Campohermoso
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: