Re: AssertionFailure null id in entry
Ok, shortened, this is what my mapping class looks like:
@Entity (access=AccessType.PROPERTY)
@Table(name= "MYTABLE", catalog= "MYCATALOG",
uniqueConstraints= {@javax.persistence.UniqueConstraint(columnNames=
{"MYROW1", "MYROW2", "MYROW3"})}
)
public class DomainRegistration implements Serializable{
private Integer id;
private String MYROW1;
private String MYROW2;
private String MYROW3;
@Id (generate=GeneratorType.AUTO)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMYROW1() {
return this.MYROW1;
}
@Column (insertable=true, updatable=true, name="MYROW1")
public void setMYROW1(String MYROW1) {
this.MYROW1 = MYROW1;
}
public String getMYROW2() {
return this.MYROW2;
}
@Column (insertable=true, updatable=true, name="MYROW2")
public void setMYROW2(String MYROW2) {
this.MYROW2 = MYROW2;
}
public String getMYROW3() {
return this.MYROW3;
}
@Column (insertable=true, updatable=true, name="MYROW3")
public void setMYROW3(String MYROW3) {
this.MYROW3 = MYROW3;
}
public boolean equals(Object o) {
if (this == o) return true;
return false;
}
public int hashCode(){
return -1;
}
public String toString(){
return "";
}
}
However, as stated before, when I have a duplicate unique key, it
throws the weird error ("dont flush the session...") I stated above.
Now deleted the id autoincrement field from my mapping class and used
the unique key as a primary key, so I used an aditional mapping class
just for this unique key - hmmmm makes me thinking - maybe the problem
was that you ALWAYS need a separate mapping class for key - be it a
primary, foreign or unique key - could this be the reason?!
Thanks in advance,
Stefanie