Error querying database. cannot invoke "Object.hashCode()" because "key" is null

529 Views Asked by At

I'm getting the following error

Error Querying database. cannot invoke "Object.hashCode()" because "key" is null

  1. stack trace:

org.mybatis.spring.MyBatisSyste Exception: nested
    exception is org.apache.ibatis.exceptions.Pers istenceException:
    ### Error querying database. Cause: java.lang. NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null
    ### The error may exist in class path resource [SbmtMapper.xml]
    ### The error may involve com.delta.crew.dao.mapper.Subm itMapperlfc.getRotnAndLegs
    ### The error occurred while handling results
    ### SQL: WITH ROTATIONS AS (SELECT OP.EMPL ID AS usrld. 'SBMT' AS opType, OVER NB AS version

UNION ALL SELECT RTN.*
FROM ROTATIONS RTN
### Cause: java.lang.NullPointerException: Cannot invoke "Obiect.hashCode(" because "key" is null
at com.delta.crew .dao .SubmitDaolmp-getRotnAndLegs(SubmitDaolmp.java:52) ~[main/:?]
at com delta.crew da SubmitDaolmp$$FastClassBySpringCGLIB$Sd3034a58,.invoke(<generated>)~[main/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)~[spring-core-5.3.10.jar:5.3.101
at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)
~[spring-aop-5.3.10.jar:5.3.101
at org.springframework.aop.framework.ReflectiveMethodinvocation.proceed(ReflectiveMethodinvocation.java:163)~
[spring-aop-5.3.10.jar:5.3.101
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)~

The error may exist in some mybatis mapper.xml and the error occurred while handling the results of the below SQL query. The SQL query has null values set.

Example :

Mapper

<resultMap id = "rotsMap" type = SubmitPojo">
<result column="ROTATION_ID" property = "rots_id" />
<result column="ARRIVAL_TIME" property = "arrTime" />
<result column="SBMT_ID" property ="sbmt_id>

Select statement

<select id="getRots" resultMap="rotsMap">
SELECT NULL AS ROTATION_ID
NULL AS ARRIVAL_TIME
OP.SBMT_ID AS SBMT_ID
FROM ROTATION OP;
</select>

I tried setting all the mappings correctly. I'm not sure what went wrong

0

There are 0 best solutions below