hibernate的get与load的主要区别:

  • 使用load时,当对象不存在,抛出一个异常nested exception is org.hibernate.ObjectNotFoundException.

          使用get时,当对象不存在,返回null

  • 使用load方法可以有效地利用hibernate的缓存,但是get是直接从数据库中读取.
posted on 2008-01-03 11:42  站得更高,看得更远  阅读(153)  评论(0编辑  收藏  举报