This commit is contained in:
@@ -3,7 +3,6 @@ package org.yacos.core.article;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@@ -26,30 +25,30 @@ public class PreferencePK implements Serializable{
|
||||
/**
|
||||
* Public key, following these recomandations : http://www.jpox.org/docs/1_2/primary_key.html
|
||||
*/
|
||||
@Id
|
||||
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
public User pcMember;
|
||||
/**
|
||||
* Public key, following these recomandations : http://www.jpox.org/docs/1_2/primary_key.html
|
||||
*/
|
||||
@Id
|
||||
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
public Article article;
|
||||
|
||||
// @Override
|
||||
// public boolean equals(Object obj) {
|
||||
// if (! (obj instanceof PreferencePK) ) {
|
||||
// return false;
|
||||
// }
|
||||
// PreferencePK other = (PreferencePK) obj;
|
||||
// return this.pcMember.getLogin().equals(other.pcMember.getLogin()) &&
|
||||
// this.article.getId() == other.article.getId();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int hashCode() {
|
||||
// return this.pcMember.getLogin().hashCode() ^ this.article.getId();
|
||||
// }
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (! (obj instanceof PreferencePK) ) {
|
||||
return false;
|
||||
}
|
||||
PreferencePK other = (PreferencePK) obj;
|
||||
return this.pcMember.getLogin().equals(other.pcMember.getLogin()) &&
|
||||
this.article.getId() == other.article.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.pcMember.getLogin().hashCode() ^ this.article.getId();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user