/* * User1.java * * Created on 03 October 2006, 09:09 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package uk.ac.lancs.illos.ejb.play; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; /** * * @author hearnc */ @Entity public class User1 implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; String userName; @JoinTable(name = "userroles1", joinColumns = {@JoinColumn(name = "userId", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "roleId", referencedColumnName = "id")}) @ManyToMany private java.util.Collection roles; /** Creates a new instance of User1 */ public User1() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public int hashCode() { int hash = 0; hash += (this.id != null ? this.id.hashCode() : 0); return hash; } public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof User1)) { return false; } User1 other = (User1)object; if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false; return true; } public String toString() { return "uk.ac.lancs.illos.ejb.play.User1[id=" + id + "]"; } public void setUserName(String userName) { this.userName = userName; } public String getUserName() { return userName; } }