No entity found for query
来源:互联网 发布:mysql存放路径 编辑:程序博客网 时间:2024/05/21 21:36
getSingleResult()
getSingleResult的源码有一句: @throws EntityNotFoundException if there is no result
查不到结果时,它是抛异常的,不会返回null.
解决方式,将异常捕捉
try{
Query query =this.getJpaTemplate().getEntityManager().createNativeQuery(sql,SmpRole.class);
obj = (SmpRole)query.getSingleResult();
}catch(NoResultException e){
return null;
}
getSingleResult的源码有一句: @throws EntityNotFoundException if there is no result
查不到结果时,它是抛异常的,不会返回null.
解决方式,将异常捕捉
try{
Query query =this.getJpaTemplate().getEntityManager().createNativeQuery(sql,SmpRole.class);
obj = (SmpRole)query.getSingleResult();
}catch(NoResultException e){
return null;
}
0 0
- No entity found for query
- No entity found for query
- No entity found for query
- 遇到No entity found for query
- 异常处理javax.persistence.NoResultException: No entity found for query
- javax.persistence.NoResultException: No entity found for query
- javax.persistence.NoResultException: No entity found for query
- javax.persistence.NoResultException: No entity found for query 异常解决办法
- No entity found for query令人兴奋又让人头疼的问题
- No entity found for query令人兴奋又让人头疼的问题
- getsingleresult 为空报错 javax.persistence.NoResultException: No entity found for query
- Hibernate/JPA之使用getSingleResult报异常NoResultException:No entity found for query
- no persistent classes found for query class
- No property sql found for type xxx.xxx.entity.UserdefinedGroup
- no persistent classes found for query class 的解决
- no persistent classes found for query class: Select e from
- No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClie
- error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.
- 前端学习路线
- javascript实现深拷贝的办法
- Ubuntu安装配置Samba服务器
- Hive2.1.0安装及其环境配置
- 学习地址【后续会一直添加】
- No entity found for query
- 【CodeForces】448D - Multiplication Table(二分)
- hdu1113-字符查找问题 map容器
- [Leetcode]138. Copy List with Random Pointer
- 八皇后问题
- HDU 3368 Reversi
- 需要Device.dll 时,添加后显示 无法找到PInvoke DLL Device.dll
- React Native加载网络图片失败
- 页面加载完全后立即调用js