Hibernate5 list()方法过时,那现在查询用什么方法

J2EE 码拜 8年前 (2016-06-08) 995次浏览
Hibernate 版本是5.2.0
List<Car> all = session.createQuery(“from Car”).list();
eclipse 有警告,提示The method list() from the type Query is deprecated
问一下,该用什么方法替换?
新手自学,多多指点!
解决方案

5

.list()过时了
.其他的撒 看返回值  看方法名 判断用哪个方法

15

点进去看源码的注释,maven项目的话会自动下载源码,你也可以本人导入源码。
在过时的list方法上肯定有注释写到,  让你用 xxxx method instead   来进行代替

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Hibernate5 list()方法过时,那现在查询用什么方法
喜欢 (0)
[1034331897@qq.com]
分享 (0)