package fi.otavanopisto.pyramus.domainmodel.base; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.TableGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Version; import org.hibernate.validator.constraints.NotEmpty; @Entity public class MagicKey { public Long getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public MagicKeyScope getScope() { return scope; } public void setScope(MagicKeyScope scope) { this.scope = scope; } @SuppressWarnings("unused") private void setVersion(Long version) { this.version = version; } public Long getVersion() { return version; } @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="MagicKey") @TableGenerator(name="MagicKey", allocationSize=1, table = "hibernate_sequences", pkColumnName = "sequence_name", valueColumnName = "sequence_next_hi_value") private Long id; @Column (nullable = false, unique = true) @NotEmpty private String name; @Column (updatable=false, nullable=false) @Temporal (value=TemporalType.TIMESTAMP) private Date created; @Column (nullable = false) @Enumerated (EnumType.STRING) private MagicKeyScope scope; @Version @Column(nullable = false) private Long version; }