java beans: difference between persistent field and persistent property?

余生颓废 提交于 2019-12-04 17:17:14

If the entity class uses persistence, fields Persistence accesses the entity class instance variables directly at runtime.

While on persistence property, there is a getter and a setter method for each property.

What you said should have worked on hibernate.

A link about it

You don't mention what JPA implementation you are using. Hibernate certainly allows you to access fields directly. However, it is not the default setting, so you have to specify this behavior in the mapping files with access=field. (with annotation based configuration, I would imagine you just need to annotate the fields directly ...)

What provider is that? I'd expect it to work. Anyway, just create protected getter and setter methods as a workaround if your provider needs that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!