在Hibernate和Ehcache中使用可變ID是否安全?另請注意,hashCode
基於該ID。使用Hibernate和Ehcache可變ID是否安全?
class Company implements Serializable {
String code; // PK
public int hashCode() {
return code == null ? 17 : code.hashCode();
}
public boolean equals(Object o) {
// Some obvious equals checking for type and field equality
}
}