package ru.mtusi.messenger.entity; import java.io.Serializable; import java.util.Objects; import java.util.UUID; public class IdempotencyId implements Serializable { private String key; private UUID userId; private UUID chatId; public IdempotencyId() {} public IdempotencyId(String key, UUID userId, UUID chatId) { this.key = key; this.userId = userId; this.chatId = chatId; } // equals и hashCode обязательны для JPA @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; IdempotencyId that = (IdempotencyId) o; return Objects.equals(key, that.key) && Objects.equals(userId, that.userId) && Objects.equals(chatId, that.chatId); } @Override public int hashCode() { return Objects.hash(key, userId, chatId); } }