aop.AopInvocationException: null return value from advice does not match primitive return type for
2017-03-09 11:23
1066 查看
在用hibernate进行查询的时候,发生了如下异常:
aop.AopInvocationException: null return value from advice does not match primitive return type for
here is the DAO interface:
@Query(value = “SELECT indexed FROM “+ GlobalConsts.INTELLIF_STATIC + “.” +GlobalConsts.T_NAME_OTHER_DETAIL
+” WHERE id = :id”, nativeQuery = true)
int findLast(@Param(“id”)long id);
如果该id在数据库中不存在,就会返回null,报出异常。
这里可以让返回的值变为包装类,它仅仅只会返回null,而不会报异常。
@Query(value = “SELECT indexed FROM “+ GlobalConsts.INTELLIF_STATIC + “.” +GlobalConsts.T_NAME_OTHER_DETAIL
+” WHERE id = :id”, nativeQuery = true)
Integer findLast(@Param(“id”)long id);
aop.AopInvocationException: null return value from advice does not match primitive return type for
here is the DAO interface:
@Query(value = “SELECT indexed FROM “+ GlobalConsts.INTELLIF_STATIC + “.” +GlobalConsts.T_NAME_OTHER_DETAIL
+” WHERE id = :id”, nativeQuery = true)
int findLast(@Param(“id”)long id);
如果该id在数据库中不存在,就会返回null,报出异常。
这里可以让返回的值变为包装类,它仅仅只会返回null,而不会报异常。
@Query(value = “SELECT indexed FROM “+ GlobalConsts.INTELLIF_STATIC + “.” +GlobalConsts.T_NAME_OTHER_DETAIL
+” WHERE id = :id”, nativeQuery = true)
Integer findLast(@Param(“id”)long id);
相关文章推荐
- Spring之AOP奇葩报错:Null return value from advice does not match primitive return type for
- Siebel Exception: The value entered in field Business Component of buscomp Repository WF Step does not match any value in the bo
- Siebel Exception: The value entered in field Business Component of buscomp Repository WF Step does not match any value in the bo
- java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contai in value for .....
- Description Resource Path Location Type Java compiler level does not match the version of the in...
- MyBatis异常java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- The idcode read from the device does not match the idcode in the bsdl File.
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for...
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- Troubleshooting - Exception: According to TLD or attribute directive in tag file, attribute value does not accept any expressions.
- Number range for trans./event type WA in year 2011 does not exist
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for …
- Charset from HTTP Content-Type US-ASCII does not match encoding from XML declaration GBK
- Fixing the security exception : "class /"" + packageName + "/" does not match trust level of other classes in the same package"
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette