*
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
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: what is Field Access vs. Property Access in JPA ? please give example in detail
 
Similar Threads
Entity - Field-Based Access Vs Property Based Access
Properties vs. Attributes
field or property based access
Getter/Setter vs Private
field or property based access