jpa-Primarykey relationship
- by megala
Hi created student entity in gogole app engine datastore using JPA.
Student---Coding
@Entity
@Table(name="StudentPersonalDetails", schema="PUBLIC")
public class StudentPersonalDetails {
@Id
@Column(name = "STUDENTNO")
private Long stuno;
@Basic
@Column(name = "STUDENTNAME")
private String stuname;
public void setStuname(String stuname) {
this.stuname = stuname;
}
public String getStuname() {
return stuname;
}
public void setStuno(Longstuno) {
this.stuno = stuno;
}
public Long getStuno() {
return stuno;
}
public StudentPersonalDetails(Long stuno,String stuname)
{
this.stuno = stuno;
this.stuname = stuname;
}
}
I stored Property value as follows
Stuno Stuname
1 a
2 b
If i stored Again Stuno No 1 stuname z
means it wont allow to insert the record But. It Overwrite the value
Stuno Stuname
1 z
2 b
How to solve this?