package br.edu.uniritter.liquid.democracy.model; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.MappedSuperclass; @MappedSuperclass public class BaseEntity { @Id @GeneratedValue private Long id; public void setId(Long id) { this.id = id; } public Long getId() { return id; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (getClass() != obj.getClass()) { return false; } final BaseEntity other = (BaseEntity) obj; if (id != other.id && (id == null || !id.equals(other.id))) { return false; } return true; } @Override public int hashCode() { int hash = 7; hash = 17 * hash + (this.getId() != null ? this.getId().hashCode() : 0); return hash; } }