hibernate如何访问私有字段? [英] How can hibernate access a private field?

查看:102
本文介绍了hibernate如何访问私有字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hibernate如何访问java类的私有字段/方法,例如设置@Id?



谢谢

解决方案

Like Crippledsmurf说,它使用反射。请参阅反思:打破所有规则 Hibernate:保存一个对象的合同


How can hibernate can access a private field/method of a java class , for example to set the @Id ?

Thanks

解决方案

Like Crippledsmurf says, it uses reflection. See Reflection: Breaking all the Rules and Hibernate: Preserving an Object's Contract.

这篇关于hibernate如何访问私有字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆