accountrole.java.svn-base
来自「EJB3 Annotation Sample」· SVN-BASE 代码 · 共 97 行
SVN-BASE
97 行
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.s7turn.security.entity;import java.io.Serializable;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.JoinColumn;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.Table;/** * * @author Long */@Entity@NamedQueries ({ @NamedQuery (name = "AccountRole.findByAccount", query = "SELECT r FROM AccountRole r WHERE r.account = :account"), @NamedQuery (name = "AccountRole.findByRole", query = "SELECT r FROM AccountRole r WHERE r.role = :role" ), @NamedQuery (name = "AccountRole.findByRoles", query = "SELECT r FROM AccountRole r WHERE r.role in( :roles )" ), @NamedQuery (name = "AccountRole.findRolesByAccount", query = "SELECT r FROM AccountRole r WHERE r.account = :account" ) //@NamedQuery (name = "AccountRole.DeleteAccountRole", query = "DELETE FROM AccountRole r WHERE r.account = :account AND r.role=:role" ) })@Table(name="account_role")public class AccountRole implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column( name = "account_role_id" ) private Long id; @JoinColumn( name = "account_id" ) private Account account; @JoinColumn( name = "role_id" ) private Role role; public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } 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 AccountRole)) { return false; } AccountRole other = (AccountRole) 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.AccountRole[id=" + id + "]"; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?