728x90
반응형
728x90
반응형
728x90
반응형

SELECT STREET_BILLTO
FROM TABLE_NAME
 {executed in 0 msec} 
20200428 09:17:55.606 [pool-1-thread-1] INFO j.resultsettable - 
|--------------|
|street_billto |
|--------------|
|--------------|
 
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in file [\projectfolder\out\production\resources\mapper\TestMapper.xml]
### The error may involve com.test.projectfolder.repository.TestMapper.testNullValue
### The error occurred while handling results
### SQL: SELECT STREET_BILLTO   FROM TABLE_NAME
### Cause: java.lang.NullPointerException
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy65.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy137.testNullValue(Unknown Source)
at com.test.projectfolder.schedule.ScheduleService.testNullValue(ScheduleService.java:272)
at com.test.projectfolder.schedule.ScheduleEventCron.testEvent(ScheduleEventCron.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in file [\projectfolder\out\production\resources\mapper\TestMapper.xml]
### The error may involve com.test.projectfolder.repository.TestMapper.testNullValue
### The error occurred while handling results
### SQL: SELECT STREET_BILLTO   FROM TABLE_NAME
### Cause: java.lang.NullPointerException
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 21 more
Caused by: java.lang.NullPointerException
at net.sf.log4jdbc.sql.resultsetcollector.DefaultResultSetCollector.methodReturned(DefaultResultSetCollector.java:204)
at net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy.reportAllReturns(ResultSetSpy.java:100)
at net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy.reportReturn(ResultSetSpy.java:192)
at net.sf.log4jdbc.sql.jdbcapi.ResultSetSpy.wasNull(ResultSetSpy.java:2497)
at com.zaxxer.hikari.pool.HikariProxyResultSet.wasNull(HikariProxyResultSet.java)
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:70)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:520)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:401)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:355)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:330)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:303)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:196)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
... 27 more

 

 

해당 쿼리는 실행시 문제가 없다.

다만, mybatis를 통하기만하면 이런 에러가 난다.

그래서 문제 없이 조회한 컬럼들과 비교해 보니 해당 컬럼에서는 null인 값들이 있다.

그래서 널인 경우 처리를 해주었더니 해결.

 

SELECT 

ISNULL(STREET_BILLTO, '') as STREET_BILLTO
FROM TABLE_NAME

 

728x90
반응형
728x90
반응형
1
2
3
4
5
6
7
8
9
10
SELECT
      T.name AS table_name, C.name AS column_name
   FROM
      sys.tables AS T
   INNER JOIN
      sys.columns AS C
   ON
      T.object_id = C.object_id
   WHERE
      C.name = '컬럼명'
cs

 

728x90
반응형

+ Recent posts