Announcement Announcement Module
Collapse
No announcement yet.
iBatis: execution hangs with UPDATE SET (xx, xx) = (SELECT xx, xx) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • iBatis: execution hangs with UPDATE SET (xx, xx) = (SELECT xx, xx)

    sqlmap
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
    <sqlMap namespace="SIMULATION">
    
      <update id="updateFromRealhyotakuToSimHyotaku" parameterClass="java.math.BigDecimal">
        UPDATE SDE.T_SIM_HYOTAKU sim
        SET ( sim.NEDUID,
              sim.TEDDATE,
              sim.ROSEN_NO
            ) = ( SELECT #value#,
                         CURRENT_TIMESTAMP,
                         real.ROSEN_NO
                  FROM SDE.T_HYOTAKU real
                  WHERE sim.SLINKID = real.SLINKID
            )
        
      </update>
    
    </sqlMap>
    java code
    Code:
    public long syncToHyotaku(BigDecimal nedUid) {
    	long rowsAffected = 0;
    	
    	rowsAffected = getSqlMapClientTemplate().update("SIMULATION.updateFromRealhyotakuToSimHyotaku", nedUid);
    	
    	return rowsAffected;
    	
    }
    the above code hangs (doesn't ends) during update execution...

    could you try this one...

    *environment
    Oracle 10g
    Oracle Driver ojdbc14-10.2.0.2
    Spring 2.5.6.SEC01
    ibatis-sqlmap 2.3.4.726

  • #2
    There's a bug in com.ibatis.sqlmap.engine.execution.SqlExecutor.exe cuteUpdate?

    executeUpdate method of SqlExecutor class
    Code:
      /**
       * Execute an update
       *
       * @param statementScope    - the request scope
       * @param conn       - the database connection
       * @param sql        - the sql statement to execute
       * @param parameters - the parameters for the sql statement
       * @return - the number of records changed
       * @throws SQLException - if the update fails
       */
      public int executeUpdate(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException {
        ErrorContext errorContext = statementScope.getErrorContext();
        errorContext.setActivity("executing update");
        errorContext.setObjectId(sql);
        PreparedStatement ps = null;
        setupResultObjectFactory(statementScope);
        int rows = 0;
        try {
          errorContext.setMoreInfo("Check the SQL Statement (preparation failed).");
          ps = prepareStatement(statementScope.getSession(), conn, sql);
          setStatementTimeout(statementScope.getStatement(), ps);
          errorContext.setMoreInfo("Check the parameters (set parameters failed).");
          statementScope.getParameterMap().setParameters(statementScope, ps, parameters);
          errorContext.setMoreInfo("Check the statement (update failed).");
          ps.execute();
          rows = ps.getUpdateCount();
        } finally {
          closeStatement(statementScope.getSession(), ps);
        }
        return rows;
      }
    the above ps.execute() hangs and doesn't return any errors or information...
    that's why I considering this as a bug...

    could you try put breakpoint on that point and you will see...

    Comment

    Working...
    X