Why is “public” not allowed for properties in JPA entities?

前端 未结 3 1833
悲哀的现实
悲哀的现实 2021-01-18 06:21

The JPA 2.0 specification says on page 22:

The instance variables of a class must be private, protected, or package visibility independent of whet

3条回答
  •  粉色の甜心
    2021-01-18 06:57

    With DataNucleus as JPA provider you could use public fields, but you would then need to mark any classes that access these fields as "persistence aware" (see the DataNucleus docs), so they can be enhanced to cater for this

提交回复
热议问题