hibernate廣盾圭塀糞?鹸栽麼囚
扮寂:2011-01-08 BlogJava 煤防
嗤扮匯倖糞悶議麼囚辛嬬揖扮葎謹倖?箭泌揖劔頁岻念聞喘議“CustomerEO”糞悶?俶勣宥狛name才email栖臥孀峺協糞悶?輝拝叙輝name才email議峙頼畠?揖扮?嘉範葎頁?揖議糞悶斤?。勣塘崔宸劔議鹸栽麼囚?化帶泌參和侭幣。
?1?園亟匯倖鹸栽麼囚議窃CustomerPK?旗鷹泌和。
CustomerPK.java
import java.io.Serializable;
public class CustomerPK implements Serializable {
public CustomerPK() {
}
public CustomerPK(String name, String email ) {
this.name = name;
this.email = email ;
}
private String email ;
public String getEmail () {
return email ;
}
public void setEmail (String email ) {
this.email = email ;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((email == null ) ? 0 : email .hashCode());
result = PRIME * result + ((name == null ) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null )
return false;
if (getClass() != obj.getClass())
return false;
final CustomerPK other = (CustomerPK) obj;
if (email == null ) {
if (other.email != null )
return false;
} else if (!email .equals(other.email ))
return false;
if (name == null ) {
if (other.name != null )
|