/** * For copyright information see the LICENSE document. */ package gwlpr.database.entities; import java.io.Serializable; import java.util.Collection; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author _rusty */ @Entity @Table(name = "levels") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Level.findAll", query = "SELECT l FROM Level l"), @NamedQuery(name = "Level.findByLevel", query = "SELECT l FROM Level l WHERE l.level = :level"), @NamedQuery(name = "Level.findByAttributePoints", query = "SELECT l FROM Level l WHERE l.attributePoints = :attributePoints")}) public class Level implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "Level") private Integer level; @Basic(optional = false) @Column(name = "AttributePoints") private int attributePoints; @OneToMany(mappedBy = "level") private Collection characterCollection; public Level() { } public Level(Integer level) { this.level = level; } public Level(Integer level, int attributePoints) { this.level = level; this.attributePoints = attributePoints; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public int getAttributePoints() { return attributePoints; } public void setAttributePoints(int attributePoints) { this.attributePoints = attributePoints; } @XmlTransient public Collection getCharacterCollection() { return characterCollection; } public void setCharacterCollection(Collection characterCollection) { this.characterCollection = characterCollection; } @Override public int hashCode() { int hash = 0; hash += (level != null ? level.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Level)) { return false; } Level other = (Level) object; if ((this.level == null && other.level != null) || (this.level != null && !this.level.equals(other.level))) { return false; } return true; } @Override public String toString() { return "gwlpr.database.entities.Level[ level=" + level + " ]"; } }