0

SimpleJdbcInsert を使用してレコードを保存していますが、次のコードを実行すると例外が発生します。ログを見ると、Spring がすべてのパラメーターを 2 倍にして挿入クエリを生成していることがわかりました。どこに問題があるか言ってください。

SimpleJdbcInsert sj = new SimpleJdbcInsert(dataSource).withTableName("SAMPLETABLE");
Map<String, Object> parameters = new HashMap<String, Object>();

parameters.put("col1",rcno);
parameters.put("col2", msg.getId());
parameters.put("col3", msg.getSripId());
parameters.put("col4", msg.getTransType());
parameters.put("col5", new Timestamp(msg.getTransDate().getTime()));
parameters.put("col6", msg.getTransStatus());


sj.includeSynonymsForTableColumnMetaData();
Number id = sj.execute(parameters);

-------------------------------------------------------------
Exception in logs
--------------------------------------------------------------



org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO APPEVENTINFO (col1,
col2, col3, col4, col5, col6, col1,
col2, col3, col4, col5, col6) VALUE
S(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is java.sql.SQ
LSyntaxErrorException: ORA-00957: duplicate column namea

        at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:94)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTran
    slator.java:72)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTran
    slator.java:80)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:812)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:868)
        at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:872)
        at org.springframework.jdbc.core.simple.AbstractJdbcInsert.executeInsertInternal(AbstractJdbcInsert.java:366)
        at org.springframework.jdbc.core.simple.AbstractJdbcInsert.doExecute(AbstractJdbcInsert.java:344)
        at org.springframework.jdbc.core.simple.SimpleJdbcInsert.execute(SimpleJdbcInsert.java:114)
        at com.tmobile.augustus.daoimpl.ApplicationEventInformationDAOImpl.create(ApplicationEventInformationDAOImpl.java:81)
        at com.tmobile.augustus.services.mdp.ApplicationEventMessageService.onMessage(ApplicationEventMessageService.java:50)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContaine
r.java:562)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.
java:500)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainenter code here
er.java:468)
        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessag
eListenerContainer.java:326)
        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageL
istenerContainer.java:264)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(Defaul
tMessageListenerContainer.java:1071)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(De
faultMessageListenerContainer.java:1063)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageLis
tenerContainer.java:960)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00957: duplicate column name

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1010)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3657)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1350)
        at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:172)
        at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:818)
        at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)
        ... 17 more
2014-09-22 16:10:52,681 DEBUG com.tmobile.augustus.componentimpl.ApplicationEventMessageSenderImpl$LocalMessageCreator  - CAL
4

1 に答える 1