Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7817153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:08:19+00:00 2026-06-02T06:08:19+00:00

i’m trying to figure wether there’s a difference betweeen anotating (let’s take @id as

  • 0

i’m trying to figure wether there’s a difference betweeen anotating (let’s take @id as an example) a getter method and the concerned field directly , in case i annotate the field , does JPA use some kind of reflection to invok the corresponding getter ?
because in my case i’m trying to obfuscate my entity classes , so i’m looking for a way to keep the business logic since the getters will be renamed into something like aaa() .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:08:20+00:00Added an answer on June 2, 2026 at 6:08 am

    Here’s what the section 2.3.1 of the JPA2 specification says:

    By default, a single access type (field or property access) applies to
    an entity hierarchy. The default access type of an entity hierarchy is
    determined by the placement of mapping annotations on the attributes
    of the entity classes and mapped superclasses of the entity hierarchy
    that do not explicitly specify an access type. An access type is
    explicitly specified by means of the Access annotation[6], as
    described in section 2.3.2. When annotations are used to define a
    default access type, the placement of the mapping annotations on
    either the persistent fields or persistent properties of the entity
    class specifies the access type as being either field- or
    property-based access respectively.

    • When field-based access is used, the object/relational mapping annotations for the entity class annotate the instance variables, and
      the persistence provider runtime accesses instance variables directly.
      All non-transient instance variables that are not annotated with the
      Transient annotation are persistent.
    • When property-based access is used, the object/relational mapping annotations for the entity class annotate the getter property
      accessors[7], and the persistence provider runtime accesses persistent
      state via the property accessor methods. All properties not annotated
      with the Transient annotation are persistent.
    • Mapping annotations must not be applied to fields or properties that are transient or Transient.

    All such classes in the entity hierarchy whose access type is
    defaulted in this way must be consistent in their placement of
    annotations on either fields or properties, such that a single,
    consistent default access type applies within the hierarchy. Any
    embeddable classes used by such classes will have the same access type
    as the default access type of the hierarchy unless the Access
    annotation is specified as defined below. It is an error if a default
    access type cannot be determined and an access type is not explicitly
    specified by means of annotations or the XML descriptor. The behavior
    of applications that mix the placement of annotations on fields and
    properties within an entity hierarchy without explicitly specifying
    the Access annotation is undefined.

    So, if you want to avoid problems with the obfuscation, then annotate the fields and not the getters, consistently, or use the @Access annotation to force field access type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.