EntityManager的find()与getReference()的区别
来源:互联网 发布:淘宝和快递合作多少钱 编辑:程序博客网 时间:2024/05/02 01:04
先说相同点
IllegalStateException
- if this EntityManager has been closed.在传入的第一个参数不是实体或者第二个参数不是一个有效的主键的情况下抛出
IlegalArgumentException
- if the first argument does notdenote an entity type or the second argument is not a valid typefor that entity's primary key
不同点:
EntityNotFoundException
- if the entity state cannot beaccessed
某些场合下使用getReference()方法可以避免从数据库加载持久状态的性能开销。
又如:
操作
em.remove(em.getReference(Person.class,1))
em.remove(em.find(Person.class,1))
- EntityManager的find()与getReference()的区别
- EntityManager的find()与getReference()的区别
- EntityManager的find()与getReference()的区别
- EntityManager的find()与getReference()的区别
- JPA中EntityManager的find()与getReference()的区别
- JPA性能方法------EntityManager的find()与getReference()的区别
- EJB3的EntityManager的find和getReference区别
- EntityManager的find()与getReference()的区别(org.hibernate.lazyinitializationexception could not initialize proxy no session)
- EntityManager getReference
- 11. JPA EntityManager find和getReference方法异同
- entityManager来主键查找类和entityManager.createQuery的区别
- JPA find() vs. getReference()
- has与find的区别
- EntityManager的注入
- EntityManager的注入
- JPA的EntityManager操作
- locate命令与find命令的区别
- locate命令与find命令的区别
- web前端开发应该知道的
- String类
- 学习bisect模块保持列表排序
- 状态机的两种写法
- busmouse.h 头文件分析 \linux-1.0\linux\include\linux\busmouse.h
- EntityManager的find()与getReference()的区别
- 折线分割平面 hdu2050 递推
- android 4.0如何打开无线设置界面
- could not find the main class. program will exit问题的解决方法
- 图像工作回顾之一:运动分析
- TLD取经之路(5)-- 此处省略XX字
- linux释放垃圾内存
- linux下搭建ipv6测试环境
- 详解android Handler使用