我已將Hibernate更新至5.2.2版本,並且不贊成使用uniqueResult()方法。我正在閱讀德文檔,但我找不到應使用哪種方法來替換它?提前致謝!!Hibernate UniqueResult已棄用
2
A
回答
0
據我一直在閱讀文檔,而不是使用uniqueResult()
,休眠提出getSingleResult()
方法與try/catch
塊。當結果不唯一時,這是處理異常的更好方法。
1
即使我發現了同樣的問題。顯然,使用org.hibernate.query.Query類的所有類型的查詢都被棄用。而不是使用javax.persistence.TypedQuery類,不推薦使用此類的方法。 但我對Hibernate的瞭解還是有限的。
0
我用getSingleResult()
與try/catch
而不是uniqueResult()
和工作。注意抓org.hibernate.NonUniqueResultException
,因爲我抓到javax.persistence.NonUniqueResultException
並且不起作用。
相關問題
- 1. Hibernate - AnnotationConfiguration已棄用
- 2. hibernate - uniqueResult默默地失敗
- 3. Hibernate 5.2.5.Final createSQLQuery()方法已棄用
- 4. org.hibernate.dialect.PostgreSQLDialect已被棄用
- 5. Base64Encoding已棄用:iOS 7.0中已棄用
- 6. [棄權] MultiJson.decode已棄用
- 7. DLR:IAttributesCollection已棄用?
- 8. setCellValue已棄用
- 9. stringWithContentsOfFile已棄用
- 10. 'sharedDispatcher'已棄用
- 11. 'initWithFrame:reuseIdentifier'已棄用
- 12. setFont已棄用?
- 13. UIPopoverController已棄用
- 14. CURLM_CALL_MULTI_PERFORM已棄用
- 15. 已棄用Httpclient
- 16. MKReverseGeocoder已棄用
- 17. AuthorizationExecuteWithPrivileges已棄用
- 18. SVNWCUtil.createDefaultAuthenticationManager已棄用
- 19. File.toURL()已棄用?
- 20. Android:getIntent()已棄用
- 21. 已棄用`route.transitionTo`?
- 22. OnCameraChangeListener()已棄用
- 23. FAXCOMEXLIB已棄用?
- 24. AndroidHttpClient已棄用
- 25. 'dismissModalViewControllerAnimated:'已棄用
- 26. 'gtk_widget_override_font'已棄用
- 27. GameObject.renderer已棄用
- 28. LSOpenApplication已棄用?
- 29. sharedScheduler已棄用?
- 30. 已棄用c#