This week's book giveaway is in the JavaScript forum.
We're giving away four copies of JavaScript Promises Essentials and have Rami Sarieddine on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes what is Field Access vs. Property Access in JPA ? please give example in detail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "what is Field Access vs. Property Access in JPA ? please give example in detail" Watch "what is Field Access vs. Property Access in JPA ? please give example in detail" New topic
Author

what is Field Access vs. Property Access in JPA ? please give example in detail

kish kumar
Ranch Hand

Joined: Jan 03, 2008
Posts: 54
what is Field Access vs. Property Access in JPA ? please give example in detail
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
JPA needs to access the data from your object to persist them. It can access the data in two ways, FIELD and PROPERTY access. FIELD access accesses the class fields (attributes/instance variables) directly, normally through reflection or byte code weaving. PROPERTY access accesses the data through calling a get/set method on your classes, also normally through reflection or byte code weaving.

For field access you annotate your class fields. For property access you annoate you get methods.

i.e.
@Basic
private String name;

or,
@Basic
public String getName() {
return this.name;
}

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
kish kumar
Ranch Hand

Joined: Jan 03, 2008
Posts: 54
Thanks for the information
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is Field Access vs. Property Access in JPA ? please give example in detail