Computer/iBatis
[iBatis] update문에서 sqlMap의 매칭
인생이글케쉬우냐
2009. 9. 18. 17:57
급작스러운 로직 변경으로 인해 업데이트문을 새롭게 추가해야만 하는 상황이 되었다.
나름 열심히 머리로 코딩했다. - 천재?-_-;
그리고 그대로 옮겨서 했는데..
이론대로라면 완벽한데, 아래와 같은 익셉션 발생!!
============================================================================================
com.ibatis.sqlmap.client.SqlMapException: There is no statement named updateLastModifiedDate in this SqlMap.
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:231)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:448)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.update(SqlMapClientImpl.java:66)
at com.twotrack.condor.geofence.batch.GeofenceAlertDAO.updateLastModifiedDate(GeofenceAlertDAO.java:36)
at com.twotrack.condor.geofence.batch.GeofenceAlertProcessor.updateLastModifiedDate(GeofenceAlertProcessor.java:78)
at com.twotrack.condor.geofence.batch.GeofenceAlertDaemon.runDaemon(GeofenceAlertDaemon.java:277)
at com.twotrack.condor.geofence.batch.GeofenceAlertDaemon.run(GeofenceAlertDaemon.java:198)
at com.twotrack.condor.geofence.batch.GeofenceAlertDaemon.main(GeofenceAlertDaemon.java:366)
===========================================================================================
보면 updateLastModifedDate가 SqlMap에 없다고 나오는데,
일부러 직접 이름을 복사하여 박은 이름인데 없을리가 없었다.
아래는 그 sqlmap.
<sqlMap namespace="GeofenceAlert">
...
<update id="updateLastModifiedDate" parameterClass="com.twotrack.condor.geofence.batch.GeofenceAlertDTO">
UPDATE
TB_GEOFENCE_ALERT
SET
LASTMODIFIED_DT = #m_dtLastModifiedDate#
WHERE
GEOFENCE_ALERT_ID = #m_nGeofenceAlertID#
</update>
....
</sqlMap>
그런데 문제는 의외로 간단히 해결되었다.
아래 sql문을 호출하는 곳을 보면, 해당 쿼리문 이름만 적혀있고, 어떤 네이밍 스페이스인지 명확하지 않다.
.....
public void updateLastModifiedDate( SqlMapClient sqlMap, GeofenceAlertDTO geofenceAlertDTO) throws Exception
{
sqlMap.update( "updateLastModifiedDate", geofenceAlertDTO);
}
즉, updateLastModifiedDate 을 GeofenceAlert.updateLastModifiedDate로 변경해주자마자 깔끔히 해결되었다.
나름 열심히 머리로 코딩했다. - 천재?-_-;
그리고 그대로 옮겨서 했는데..
이론대로라면 완벽한데, 아래와 같은 익셉션 발생!!
============================================================================================
com.ibatis.sqlmap.client.SqlMapException: There is no statement named updateLastModifiedDate in this SqlMap.
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:231)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:448)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.update(SqlMapClientImpl.java:66)
at com.twotrack.condor.geofence.batch.GeofenceAlertDAO.updateLastModifiedDate(GeofenceAlertDAO.java:36)
at com.twotrack.condor.geofence.batch.GeofenceAlertProcessor.updateLastModifiedDate(GeofenceAlertProcessor.java:78)
at com.twotrack.condor.geofence.batch.GeofenceAlertDaemon.runDaemon(GeofenceAlertDaemon.java:277)
at com.twotrack.condor.geofence.batch.GeofenceAlertDaemon.run(GeofenceAlertDaemon.java:198)
at com.twotrack.condor.geofence.batch.GeofenceAlertDaemon.main(GeofenceAlertDaemon.java:366)
===========================================================================================
보면 updateLastModifedDate가 SqlMap에 없다고 나오는데,
일부러 직접 이름을 복사하여 박은 이름인데 없을리가 없었다.
아래는 그 sqlmap.
<sqlMap namespace="GeofenceAlert">
...
<update id="updateLastModifiedDate" parameterClass="com.twotrack.condor.geofence.batch.GeofenceAlertDTO">
UPDATE
TB_GEOFENCE_ALERT
SET
LASTMODIFIED_DT = #m_dtLastModifiedDate#
WHERE
GEOFENCE_ALERT_ID = #m_nGeofenceAlertID#
</update>
....
</sqlMap>
그런데 문제는 의외로 간단히 해결되었다.
아래 sql문을 호출하는 곳을 보면, 해당 쿼리문 이름만 적혀있고, 어떤 네이밍 스페이스인지 명확하지 않다.
.....
public void updateLastModifiedDate( SqlMapClient sqlMap, GeofenceAlertDTO geofenceAlertDTO) throws Exception
{
sqlMap.update( "updateLastModifiedDate", geofenceAlertDTO);
}
즉, updateLastModifiedDate 을 GeofenceAlert.updateLastModifiedDate로 변경해주자마자 깔끔히 해결되었다.
반응형