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 6619681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:00:01+00:00 2026-05-25T21:00:01+00:00

I am reading the Beginning Java EE6 Platform and Glassfish 3 book and I

  • 0

I am reading the Beginning Java EE6 Platform and Glassfish 3 book and I have some minor difficulties at understanding Access type on field/properties. What is the difference between the two of them?

Is it how the properties are read/set by the JPA implementation (in this case EclipseLink)? Like, if it is property access the values are read/set through possible validations etc that can be placed in the get/set method, while the field access option does not do setting/getting values through these methods but straight on the fields? And does the type get set by where I am placing the @Id annotation?

  • 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-05-25T21:00:02+00:00Added an answer on May 25, 2026 at 9:00 pm

    The @Access annotation type indicates how the JPA should set or get the field in your object. An AccessType.FIELD the JPA will set the field directly with reflection and will not use any provided setter method., very useful if your class tracks the “dirtyness” of a field through the setter methods. In contrast setting @Access(value=AccessType.PROPERTY) will instruct the JPA to use the setter and getter methods when it accesses fields.

    You can prove this to yourself by adding logging or System.out.printlns to your setter methods and then making changes to the @Access annotation. For example:

    @Id
    @Access(value=AccessType.PROPERTY)
    private Long Id;
    public void setId(Long id) { System.out.println("SET"); this.Id = id; }
    

    Will print SET and this:

    @Id
    @Access(value=AccessType.FIELD)
    private Long Id;
    public void setId(Long id) { System.out.println("SET"); this.Id = id; }
    

    Will NOT!

    It also does not matter where you place the annotations, at least in Hibernate ;-).

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

Sidebar

Related Questions

I've been reading the Beginning iPhone 4 Development book and they have one tutorial
I'm reading Beginning Java Game Programming 2/e and the book heavily emphasizes using AffineTransform.
Possible Duplicate: Java Synchronization I'm reading the book Beginning Android Games . It uses
I have been reading the book called Beginning Android Games by Mario Zechner and
I'm reading the Beginning CouchDB book by Apress and there is a line that
I have been reading SO for some time now, but I truly cannot find
I was reading the GoF book and in the beginning of the prototype section
I'm reading the book Beginning Android Games and the code won't compile. All of
I have been reading some of the perl513*delta files and I have seen some
I an reading through some examples of normalization, however I have come across one

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.