I am working on JPA and JSF.
I found two ways to put the annotation:
1. Above the instance variable.
public class Project implements Serializable {
@ID
@NotNull
private Long idProject
public Long getIdProject() {
return this.idProject
}
}
2. Above getter
public class Project implements Serializable {
private Long idProject
@ID
@NotNull
public Long getIdProject() {
return this.idProject}
}
What is the difference? What is the best to use?