I am following hibernate tutorial from the "Beginning hibernate" book. And I see that the annotations like @Id, @Column are specified above the getXXX() methods.
such as:
@Id
@GeneratedValue
public long getId()
{
return id;
}
@Column(unique=true)
public String getName()
{
return name;
}
But not in the attribute definition it self like:
private long id;
private String name;
Is there a link/reference that specifies where the annotation should be placed? and the reasoning behind it. More specifically; how does Hibernate interpret the placement of different annotations and is there a guide to it?
I am talking about the javax.persistence.* annotations
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
I have looked at http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single
I am using:
Hibernate 4.2.6.Final
Windows 8, 32 bit.