Error code '-4228'

5864 단어 ibatis
오늘 이런 오류가 생겼어요.

12:29:40.974 [main] DEBUG o.s.j.s.SQLErrorCodeSQLExceptionTranslator - Unable to translate SQLException with Error code '-4228', will now try the fallback translator
12:29:40.979 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [-4228];   
--- The error occurred in sqlMap/ehrIndex.xml.  
--- The error occurred while applying a parameter map.  
--- Check the ehrIndex.insertEhrIndex-InlineParameterMap.  
--- Check the parameter mapping for the 'flag' property.  
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][10271][10295][3.50.152]      JDBC   :0。 ERRORCODE=-4228, SQLSTATE=null; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sqlMap/ehrIndex.xml.  
--- The error occurred while applying a parameter map.  
--- Check the ehrIndex.insertEhrIndex-InlineParameterMap.  
--- Check the parameter mapping for the 'flag' property.  
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][10271][10295][3.50.152]      JDBC   :0。 ERRORCODE=-4228, SQLSTATE=null
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:364)
	at com.founder.dao.impl.EhrIndexDaoImpl.insertEhrIndex(EhrIndexDaoImpl.java:10)
	at com.founder.service.impl.IntegrationHealthRecordServiceImpl.handleEhrIndex(IntegrationHealthRecordServiceImpl.java:143)
	at com.founder.service.impl.IntegrationHealthRecordServiceImpl.invoke(IntegrationHealthRecordServiceImpl.java:68)
	at com.founder.Launch.main(Launch.java:17)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sqlMap/ehrIndex.xml.  
--- The error occurred while applying a parameter map.  
--- Check the ehrIndex.insertEhrIndex-InlineParameterMap.  
--- Check the parameter mapping for the 'flag' property.  
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][10271][10295][3.50.152]      JDBC   :0。 ERRORCODE=-4228, SQLSTATE=null
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:393)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
	at org.springframework.orm.ibatis.SqlMapClientTemplate$8.doInSqlMapClient(SqlMapClientTemplate.java:366)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
	... 5 more
Caused by: com.ibm.db2.jcc.b.SqlException: [jcc][10271][10295][3.50.152]      JDBC   :0。 ERRORCODE=-4228, SQLSTATE=null
	at com.ibm.db2.jcc.b.wc.a(wc.java:55)
	at com.ibm.db2.jcc.b.wc.a(wc.java:102)
	at com.ibm.db2.jcc.b.cb.i(cb.java:1219)
	at com.ibm.db2.jcc.b.uk.b(uk.java:612)
	at com.ibm.db2.jcc.b.uk.setNull(uk.java:584)
	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setNull(NewProxyPreparedStatement.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:70)
	at $Proxy2.setNull(Unknown Source)
	at com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameter(ParameterMap.java:172)
	at com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameters(ParameterMap.java:126)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:78)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteUpdate(MappedStatement.java:216)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:94)
	... 9 more


왜냐하면 flag이라는 속성 데이터베이스에서는CHARACTER 형식이고java 코드에서string 형식이기 때문이다. 나는 flag을null로 설정하고ibatis에서는 또 이렇게 코드를 쓴다.

insert into 
		EHR_INDEX(
			INDEX_ID,EHR_ID,EHR_NAME,PARENT_ID,
			FLAG,PERSON_ID,TYPE_ID,INDEX_SEQUENCE,
			PIX_ID,NAME,AGE,EVENT_DATE,
			EVENT_YEAR,EVENT_MONTH,DISEASE,DISEASE_NAME,
			CREATE_DATE,CREATE_UNIT,CREATE_UNIT_NAME,CREATE_DEPT,
			CREATOR,CREATOR_NAME,MODIFY_DATE,MODIFY_UNIT,
			MODIFY_DEPT,MODIFIER,MODIFIER_NAME,MGMT_FLAG,
			CREATOR_ID_NO
		)
		values(
			#indexId#,#ehrId#,#ehrName#,#parentId#,
			#flag#,#personId#,#typeId#,#indexSequence#,
			#pixId#,#name#,#age#,#eventDate#,
			#eventYear#,#eventMonth#,#disease#,#diseaseName#,
			#createDate#,#createUnit#,#createUnitName#,#createDept#,
			#creator#,#creatorName#,#modifyDate#,#modifyUnit#,
			#modifyDept#,#modifier#,#modifierName#,#mgmtFlag#,
			#creatorIdNo#
		)

그래서 이런 오류를 안고 관건은 코드가 규범에 맞지 않는 데 있다. 해결 방법은ibatis에서 #flag#에 유형 처리를 넣는다. 예를 들어 #flag:char#

좋은 웹페이지 즐겨찾기