package fi.otavanopisto.muikku.plugins.websocket; import java.util.Date; import javax.persistence.Cacheable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.validator.constraints.NotEmpty; @Entity @Cacheable @Cache (usage = CacheConcurrencyStrategy.TRANSACTIONAL) public class WebSocketTicket { public Long getId() { return id; } public String getTicket() { return ticket; } public void setTicket(String ticket) { this.ticket = ticket; } public Long getUser() { return user; } public void setUser(Long user) { this.user = user; } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public Date getTimestamp() { return timestamp; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; } @Id @GeneratedValue (strategy = GenerationType.IDENTITY) private Long id; @NotNull @NotEmpty @Column (nullable = false, length = 255, unique = true) private String ticket; @Column (name = "user_id") private Long user; @NotNull @NotEmpty @Column (nullable = false) private String ip; @NotNull @Column (updatable=false, nullable=false) @Temporal (value=TemporalType.TIMESTAMP) private Date timestamp; }