Hibernate UniqueResult已弃用 [英] Hibernate UniqueResult Deprecated

查看:355
本文介绍了Hibernate UniqueResult已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Hibernate更新为5.2.2版本,并且不赞成使用uniqueResult()方法。我正在阅读德文档,但我找不到应使用哪种方法来替换它?提前致谢!!

I've updated Hibernate to 5.2.2 version and the uniqueResult() method is deprecated. I'm reading de documentation but I can't find which method should I use to replace it? Thanks in advance!!

推荐答案

据我一直在阅读文档,而不是使用 uniqueResult(),Hibernate提出了 getSingleResult()方法,其中 try / catch 块。当结果不唯一时,这是处理异常的更好方法。

as far as I've been reading the documentation, instead of using the uniqueResult(), Hibernate propose the getSingleResult() method with a try / catch block. This is a better way of handling exceptions when the result is not unique.

这篇关于Hibernate UniqueResult已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆