diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java index be4d335..011e6e2 100644 --- a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java +++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java @@ -26,4 +26,20 @@ public class IdOnlyEntity { @GeneratedValue(generator = "snowflake") @GenericGenerator(name = "snowflake", strategy = "com.eshore.gringotts.web.configuration.SnowflakeIdGenerator") private Long id; + + @Override + public final boolean equals(Object object) { + if (this == object) + return true; + if (!(object instanceof IdOnlyEntity)) + return false; + + IdOnlyEntity that = (IdOnlyEntity) object; + return id.equals(that.id); + } + + @Override + public int hashCode() { + return id.hashCode(); + } }