Hibernateのloadとgetメソッドの違いは何ですか?Session
一致するデータベース行がない場合、load() は回復不能な例外をスローします。
一致するデータベース行がない場合、get() は null を返します。
Hibernate Creators がこのメソッドのロードを API に保持したのはなぜですか? (オブジェクトが見つからない場合、回復不能な例外がスローされるため)。get()十分ではありませんか?
Hibernateのloadとgetメソッドの違いは何ですか?Session
一致するデータベース行がない場合、load() は回復不能な例外をスローします。
一致するデータベース行がない場合、get() は null を返します。
Hibernate Creators がこのメソッドのロードを API に保持したのはなぜですか? (オブジェクトが見つからない場合、回復不能な例外がスローされるため)。get()十分ではありませんか?
There is more to this that just the exception vs null return if an entity isn't found.
Load may also return you a proxy instead of a persistent instance of your entity. This proxy would then trigger the loading of this entity when a property is first accessed.
This is discussed at length on the Hibernate forums here, previously on SO here and in plenty of other places.