JPA属性访问方式
在model中封装了一个对象,在一些属性的setter中加入了对该对象的访问,结果发现全无效果。
百度了下,原来是因为JPA有两种属性访问方式:
- 域访问(field access):无需设置getter/setter,直接在字段上设定@Column等值,在运行时注入值。
- 属性访问(property access):必须设定getter/setter,在getter上设定@Column等值,通过getter/setter注入值。
原本之前是用直接配置在字段名字上的field access方式,所以没有调用到getter/setter,
而项目使用的是1.0版本的JPA,不支持在一个entity中混用两种方式,因此我把这个entity的属性全部改为了property access。
关于域访问方式与属性访问方式的比较,可以阅读此文:[译文]JPA的实施模式:域访问和属性访问之间的比较
2022年9月29日 00:37
So students who want to learn this language and want to get high score can download NCERT Hindi Sample Paper 2023 Class 2 with answers and practice them with regular mock tests and revisions of important questions for every lesson of the course. NCERT Hindi Question Paper Class 2 Subject experts of the NCERT have designed and introduced the study and learning material for all regional Class 2nd Standard students based on the revised syllabus and curriculum of the course for Hindi Medium, English Medium and Urdu medium.