Hi I am new to Java persistence. Does it matter where I put the Annotations at? Are the following two sets of the code the same?
Thanks a lot!!
@Entity
@Table(name="user", schema="billing")
public class User {
private long id ;
private String userName ;
private String password ;
@Id
@GeneratedValue
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Column(name="password", length=20)
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name="user_name",length=15)
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
Compare to:
@Entity
@Table(name="user", schema="billing")
public class User {
@Id
@GeneratedValue
private long id ;
@Column(name="user_name",length=15)
private String userName ;
@Column(name="password", length=20)
private String password ;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}