@Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
Businessinformation other = (Businessinformation) obj;
if(this.hashCode() != other.hashCode()){
return false;
}
return true;
}
@Override
public int hashCode() {
int result;
result = (id == null? 0:id.hashCode());
result = 31*result + name.hashCode();
return result;
}
(备注:hashCode()里面如果没有name字段,可以多写几个来确定他的唯一性
比如result = 31*result +age.hashCode();result = 31*result +createTime.hashCode();等等。。)