import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratorType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Version; @Entity(name="User") @Table(name="T_USER") @Inheritance @SequenceGenerator(name="ID_SEQ", sequenceName="SEQ_USER") @NamedQueries({ @NamedQuery(name="findUserByUserName", queryString="SELECT u FROM User u WHERE u.userName = :username") }) public class User implements Serializable { private int id, versionnr; private String userName, password, description; @Id(generate=GeneratorType.SEQUENCE, generator="ID_SEQ") public int getId() { return id; } public void setId(int id) { this.id = id; } @Version public int getVersionnr() { return versionnr; } public void setVersionnr(int versionnr) { this.versionnr = versionnr; } @Column(nullable=false, unique=true) public String getUsername() { return userName; } public void setUsername(String username) { this.userName = username; } @Column(name="pass", nullable=false) public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
Comments