cn.sylinx.hbatis.ext.model.GenericModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbatis-core Show documentation
Show all versions of hbatis-core Show documentation
hbatis is a simple orm framework
package cn.sylinx.hbatis.ext.model;
import java.io.Serializable;
@SuppressWarnings("serial")
public class GenericModel extends Model {
/**
* 主键
*/
private Serializable id;
public Serializable getId() {
return id;
}
public void setId(Serializable id) {
this.id = id;
}
@Override
public int hashCode() {
if (getId() == null)
return 0;
return getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
return this.hashCode() == obj.hashCode();
}
}