account.java.svn-base

来自「EJB3 Annotation Sample」· SVN-BASE 代码 · 共 153 行

SVN-BASE
153
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.s7turn.security.entity;import java.io.Serializable;import java.security.Principal;import java.sql.Date;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.Table;/** * * @author Long */@Entity@NamedQueries ({    @NamedQuery (name = "Account.findById", query = "SELECT a FROM Account a WHERE a.id = :id"),    @NamedQuery (name = "Account.findByUserId", query = "SELECT a FROM Account a WHERE a.loginId = :loginId"),    @NamedQuery (name = "Account.findByIdAndPassword", query = "SELECT a FROM Account a WHERE a.id = :id and a.password = :password"),    @NamedQuery (name = "Account.findByLongIdAndPassword", query = "SELECT a FROM Account a WHERE a.loginId = :loginId and a.password = :password"),    @NamedQuery (name = "Account.findAllItems", query = "SELECT a FROM Account a")})@Table( name = "accounts" )public class Account  implements Principal, Serializable  {    private static final long serialVersionUID = 1L;    @Id    @Column(name="account_id")    @GeneratedValue(strategy = GenerationType.SEQUENCE)        private Long id;        @Column(name="login_id", length=32)    private String loginId;    @Column(name="acc_passwd", length=60)    private String password;    @Column(name="acc_point")    private Long point;     @Column(name="acc_email", length=80)    private String email;        @Column(name="security_question", length=80)    private String securityQuestion;        @Column(name="security_answer", length=80)    private String securityAnswer;        @Column(name="last_updated")    private Date lastUpdated;    public Date getLastUpdated() {        return lastUpdated;    }    public void setLastUpdated(Date lastUpdated) {        this.lastUpdated = lastUpdated;    }    public String getSecurityAnswer() {        return securityAnswer;    }    public void setSecurityAnswer(String securityAnswer) {        this.securityAnswer = securityAnswer;    }    public String getSecurityQuestion() {        return securityQuestion;    }    public void setSecurityQuestion(String securityQuestion) {        this.securityQuestion = securityQuestion;    }        public String getEmail() {        return email;    }    public void setEmail(String email) {        this.email = email;    }    public String getLoginId() {        return loginId;    }    public void setLoginId(String loginId) {        this.loginId = loginId;    }    public String getPassword() {        return password;    }    public void setPassword(String password) {        this.password = password;    }    public Long getPoint() {        return point;    }    public void setPoint(Long point) {        this.point = point;    }    public void setId(Long id) {        this.id = id;    }    public Long getId() {        return id;    }    @Override    public int hashCode() {        int hash = 0;        hash += (id != null ? id.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 Account)) {            return false;        }        Account other = (Account) object;        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {            return false;        }        return true;    }    @Override    public String toString() {        return "com.s7turn.security.entity.Account[id=" + id + "]";    }    public String getName() {        return getLoginId();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?