最近没事,回头看hibernate的手册,发现这么一段
4.1.3. Prefer non-final classes (semi-optional)
A central feature of Hibernate, proxies (lazy loading), depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods. You can persist final classes that do not implement an interface with Hibernate; you will not, however, be able to use proxies for lazy association fetching which will ultimately limit your options for performance tuning. To persist a final class which does not implement a "full" interface you must disable proxy generation. See 例 4.2 “Disabling proxies in hbm.xml” and 例 4.3 “Disabling proxies in annotations”.
例 4.2. Disabling proxies in hbm.xml
<class name="Cat" lazy="false"...>...</class>
例 4.3. Disabling proxies in annotations
@Entity @Proxy(lazy=false) public class Cat { ... }
If the final class does implement a proper interface, you could alternatively tell Hibernate to use the interface instead when generating the proxies. See 例 4.4 “Proxying an interface in hbm.xml” and 例 4.5 “Proxying an interface in annotations”.
例 4.4. Proxying an interface in hbm.xml
<class name="Cat" proxy="ICat"...>...</class>
例 4.5. Proxying an interface in annotations
@Entity @Proxy(proxyClass=ICat.class) public class Cat implements ICat { ... }
You should also avoid declaring public final methods as this will again limit the ability to generate proxies from this class. If you want to use a class with public final methods, you must explicitly disable proxying. Again, see 例 4.2 “Disabling proxies in hbm.xml” and 例 4.3 “Disabling proxies in annotations”.看了半天也没明天是怎么回事,
找了又找,终于晓得,还原是生成代理的时候要继承自该pojo,所以有final会覆盖不了该方法,不是怎么样来着。他也没说清。唉,英语呀,永远的痛呀
分享到:
相关推荐
-i IDX, --idx IDX IDX :要应用的注册房间索引(0表示1小时,1表示2至3小时)全部申请尝试同时申请日期的1到2到3次-p PERFER, --perfer PERFER PERFER :优先使用PERFER (0表示1小时,1表示2至3小时)
-w, --worker <number> Worker num to process message, perfer (client num)/10. (default 1024) -p, --port <port> Use port for clients (default: 1883) --host <host> Network host to listen on. (default ...
--perfer-dist:代表压缩方式下载6.0。*:代表6.0最新版本Laravel安装完后,生成APP_KEY,写入.env文件PHP的工匠键:生成 Laravel IDE-辅助插件 作曲家需要barryvdh / laravel-ide-helper config / app.php中提供者...
网站性能优化 创建人:Yaz Khoury 该项目是从Udacity的Web优化挑战中分叉的,位于以下链接: : 第1部分 概述 优化给定的网页,以使Google Pagespeed Insights得分达到90分或以上。 以下屏幕截图显示了移动设备和...
this is a chinese guidence to install kali-linux on various platform since the Penetration Testing ... For the fan of kali, there are also many chinese who perfer to install kaili for their pentest
免费和高性能MQTT经纪人 ... -w, --worker <number> Worker num to process message, perfer (client num)/10. (default 1024) -p, --port <port> Use port for clients (default: 1883) --host <host>
<span class="layui-btn" lay-event="invest_perfer">投资偏好 <span class="layui-btn" lay-event="member_photo">用户画像 ``` 这样,当用户点击表格中某一行的按钮时,对应的事件会被触发,我们可以通过`data...
放到X:\Program Files\Packet Tracer 5.0\languages 即Packet Tracer 5.0 安装地址 启动pt 在options下拉菜单perfer选项中 语言选择chinese 重启pt
Cisco packet tracer5.0及5.1的汉化文件,解压到X:\Program Files\Packet Tracer 5.0\languages 启动packet tracer 在options下拉菜单perfer选项中 语言选择chinese 重启pt
例如:“When the bell rings, we will have class.”(铃声一响,我们就上课。) 15. **It takes sb+时间/钱 to do sth / Spend+时间/钱+(in) doing sth / Spend+时间/钱+on+n.物+cost+时间/钱**: 表示花费时间和...
3. 在软件界面内,通过“options”(选项)下拉菜单找到“perfer”(可能是拼写错误,应为“Preferences”,意为偏好设置)选项。这是调整软件设置的地方。 4. 在偏好设置中,选择“语言”选项,并选取“Chinese”...
然后,查找文件名中是否包含特定字符串(`cs.Port_week_perfer_name_start`),这是根据上下文可能自定义的条件。 6. 使用`tarfile.open(dir_tmp)`打开TAR文件。这里,原本的代码注释掉了`ZipFile`,说明原本可能是...