role.java.svn-base
来自「EJB3 Annotation Sample」· SVN-BASE 代码 · 共 118 行
SVN-BASE
118 行
/* * 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.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@Table( name = "roles" )@NamedQueries({ @NamedQuery( name = "Role.findAllItems", query = "SELECT o FROM Role o"), @NamedQuery( name = "Role.findRoleById", query = "SELECT o FROM Role o WHERE o.id=:id")})public class Role implements Serializable { public final static Role REGISTERED_USER = new Role(1, "registered", "Registered User from Web by himself."); public final static Role GENERAL_USER = new Role(2, "general", "General Users."); public final static Role ADMIN_USER = new Role(3, "administrator", "Administrators for managing this system."); //public final static Role VIP_USER = new Role(); private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column( name = "role_id" ) private Long id; @Column( name = "role_name" ) private String roleName; @Column( name = "description" ) private String description; @Column( name = "last_update" ) private Date lastUpdate; public Role() { } protected Role(long md, String rn, String desc) { id = new Long(md); roleName = rn; description = desc; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Date getLastUpdate() { return lastUpdate; } public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; } public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } 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 Role)) { return false; } Role other = (Role) 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.Role[id=" + id + "]"; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?