jpa-Primarykey relationship
Posted
by megala
on Stack Overflow
See other posts from Stack Overflow
or by megala
Published on 2010-06-05T05:27:29Z
Indexed on
2010/06/05
22:12 UTC
Read the original article
Hit count: 238
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?
© Stack Overflow or respective owner