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

前端 未结 3 1870
悲哀的现实
悲哀的现实 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:52

    To be sure that accessor methods are used (like get... set.... is.... ). Thats part of the isolation principle.

提交回复
热议问题