现在的位置: 首页 > 综合 > 正文

hibernate的get与load

2012年09月14日 ⁄ 综合 ⁄ 共 173字 ⁄ 字号 评论关闭
hibernate的get与load的主要区别:
  • 使用load时,当对象不存在,抛出一个异常nested exception is org.hibernate.ObjectNotFoundException.

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

  • 使用load方法可以有效地利用hibernate的缓存,但是get是直接从数据库中读取.

抱歉!评论已关闭.