G
gk
In JPA Entity classes , I don't understand what is a persistent field
and what is a persistent property ?
I have the following understanding as below
If the Entiry class has NO getter/setter then we call the instance
variable as persistent field
For example,
public class Contact implements Serializable{
protected String firstName;
// firstName is the persistent field.
// there is no getter/setter for firstName
.........................
............................
BUT
If the Entity class has getter/setter then we call the instance
variable as persistent property
For example,
public class Contact implements Serializable{
protected String firstName; // firstName is the persistent
property.
void setfirstName(String fname){firstName=fname;}
String setfirstName(String fname){return firstName;}
.........................
............................
Could you please let me know whether I have understood the terminology
persistent field and persistent property correctly. If not , please
let me know where is the difference between them ?
and what is a persistent property ?
I have the following understanding as below
If the Entiry class has NO getter/setter then we call the instance
variable as persistent field
For example,
public class Contact implements Serializable{
protected String firstName;
// firstName is the persistent field.
// there is no getter/setter for firstName
.........................
............................
BUT
If the Entity class has getter/setter then we call the instance
variable as persistent property
For example,
public class Contact implements Serializable{
protected String firstName; // firstName is the persistent
property.
void setfirstName(String fname){firstName=fname;}
String setfirstName(String fname){return firstName;}
.........................
............................
Could you please let me know whether I have understood the terminology
persistent field and persistent property correctly. If not , please
let me know where is the difference between them ?