001package model.entity; 002 003import lombok.Getter; 004import lombok.Setter; 005 006import javax.persistence.*; 007import java.io.Serializable; 008import java.time.Instant; 009 010/** 011 * Entità rappresentate il ban di un utente 012 */ 013@Entity 014public class Ban implements Serializable { 015 016 @Getter @Setter 017 @Id @GeneratedValue(strategy = GenerationType.IDENTITY) 018 protected Integer id; 019 020 @Getter @Setter 021 @ManyToOne(optional = false, fetch = FetchType.LAZY) 022 protected User user; 023 024 @Getter 025 @Column(nullable = false, insertable = false, updatable = false) 026 protected Instant startTime; //db generated column 027 028 @Getter @Setter 029 @Column(nullable = true) 030 protected Instant endTime; 031 032 public Ban(){} 033 034 @Override 035 public boolean equals(Object o) { 036 if (this == o) return true; 037 if (!(o instanceof Ban)) return false; 038 Ban ban = (Ban) o; 039 return id.equals(ban.id); 040 } 041 042 @Override 043 public int hashCode() { 044 return getClass().hashCode(); 045 } 046}