The difference between field annotation and its production method by JPA method

I am trying to determine if there is a difference between the annotation (let’s take @id as an example) with the getter method and the corresponding field directly, in case I annotate this field, does the JPA use some kind of reflection to call the corresponding getter? because in my case I'm trying to confuse my entity classes, so I'm looking for a way to preserve business logic, since getters will be renamed to something like aaa ().

+3
source share
2 answers

This is what section 2.3.1 of the JPA2 specification says:

( ) . : . - Access [6], 2.3.2. , , class .

  • , / persistence . , .
  • , / getter accessors [7], . , Transient .
  • , .

, , , . , , , Access . , , XML. , undefined.

, , , , @Access, .

+7

JPA . , , () , , , db. , , @Id ( id getId()).

+6

All Articles