我知道這個問題重複一次。 但是,沒有人能夠簡要回答,以便正確回答。 當我嘗試使用GUID向我提供表中的記錄時,我得到Nhibernate錯誤「無給定標識符的行發現錯誤」。 我正在使用Nhibernate加載函數加載具有唯一標識符(GUID)的記錄,但是如果記錄不存在,它會發出異常。 我是否缺少hbm.xml文件中的一些屬性?Nhibernate錯誤:沒有給定標識符的行發現錯誤
1
A
回答
3
Note that Load() will throw an unrecoverable exception if there is no matching database row.
如果您想查詢特定記錄,並沒有異常,使用實際的查詢或Get()
方法。
而且從文檔:
If you are not certain that a matching row exists, you should use the Get() method, which hits the database immediately and returns null if there is no matching row.
因此,使用Get()
並檢查結果爲空。
相關問題
- 1. 流利NHibernate的1.2與SubclassMap導致「無行與給定的標識符」錯誤
- 2. Oracle中的標識符錯誤錯誤。
- 3. nHibernate查詢異常:沒有給定標識符的行
- 4. 「沒有標籤,發現」錯誤
- 5. 符號像_sqlite3_open沒有發現錯誤
- 6. 沒有applet發現錯誤?
- 7. assertRaises沒有發現錯誤
- 8. org.hibernate.ObjectNotFoundException:沒有給定標識符的行
- 9. 預期標識符錯誤或「(」錯誤
- 10. 語法錯誤:標識符(錯誤C2061)
- 11. LockWorkStation - 編譯錯誤 - 標識未發現
- 12. C++語法錯誤 - 標識未發現
- 13. PHPMailer沒有發送,沒有給出錯誤拋出500錯誤
- 14. NHibernate:沒有persister錯誤
- 15. 預期標識符錯誤?
- 16. 資源標識符錯誤
- 17. 標識符錯誤等
- 18. 沒有符合條件的包標識符提交錯誤
- 19. 錯誤:標識符「LCD_E_PORT」未定義
- 20. 標識符「ostream」未定義錯誤
- 21. C++錯誤:標識符「CWnd」未定義
- 22. 保存的CImage給出了錯誤:標識符「ImageFormatJPEG」未定義
- 23. jQuery的AJAX沒有發現錯誤
- 24. 的ffmpeg, '協議沒有發現' 錯誤
- 25. 沒有類Def的發現錯誤
- 26. 斯卡拉錯誤:標識符預期,但「}」發現
- 27. 在服務器中沒有發現類錯誤的錯誤
- 28. 休眠:多個行具有給定標識符發現
- 29. Fluent-NHibernate映射拋出「錯誤的標識符類型:System.Guid」
- 30. DynamoDB沒有接口,沒有發現DynamoDBHashKey符號錯誤
非常感謝:) – zchpit 2016-07-14 09:40:12