Added equals and hashcode override for Member entity
This commit is contained in:
parent
ef039478d5
commit
99610305b6
@ -41,7 +41,22 @@ open class Member(
|
|||||||
@SequenceGenerator(name="member_id_seq", sequenceName = "member_id_seq", allocationSize = 1)
|
@SequenceGenerator(name="member_id_seq", sequenceName = "member_id_seq", allocationSize = 1)
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "member_id_seq")
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "member_id_seq")
|
||||||
open var id: Long = -1
|
open var id: Long = -1
|
||||||
)
|
) {
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if(other === this) return true
|
||||||
|
return if(other is Member){
|
||||||
|
other.id == id
|
||||||
|
} else false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = name.hashCode()
|
||||||
|
result = 31 * result + email.hashCode()
|
||||||
|
result = 31 * result + password.hashCode()
|
||||||
|
result = 31 * result + id.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
open class Role(
|
open class Role(
|
||||||
|
Loading…
Reference in New Issue
Block a user