java.lang.reflect.InvocationTargetException : Entity Likes.Key does not override hashCode
发现 Likes里面的Key类只有Equals方法
public boolean equals(Object obj){
if(obj instanceof Key){
Key other = (Key)obj;
return article.getId() == other.article.getId() && user.getId() == other.user.getId();
}
else{
return false;
}
}
于是,补上hashCode方法;
@Override
public int hashCode() {
return article.getId();
}