resource.java

来自「EJB3 Annotation Sample」· Java 代码 · 共 112 行

JAVA
112
字号
/* * 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@Table( name="resources" )@NamedQueries({    @NamedQuery( name = "Resource.findAllItems", query="SELECT r FROM Resource r"),    @NamedQuery( name = "Resource.findById", query="SELECT r FROM Resource r WHERE r.id=:id"),    @NamedQuery( name = "Resource.findByAppDomain", query="SELECT r FROM Resource r WHERE r.appDomain = :appDomain")})public class Resource implements Serializable {    private static final long serialVersionUID = 1L;        @Id    @GeneratedValue(strategy = GenerationType.SEQUENCE)    @Column( name = "resource_id" )    private Long id;    @Column( name = "res_name" )    private String name;    @Column( name = "res_desc" )    private String description;    @Column( name = "type" )    private String type; //directory or file        @JoinColumn( name = "domain_id" )    private AppDomain appDomain;    public AppDomain getAppDomain() {        return appDomain;    }    public void setAppDomain(AppDomain appDomain) {        this.appDomain = appDomain;    }    public String getDescription() {        return description;    }    public void setDescription(String description) {        this.description = description;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public String getType() {        return type;    }    public void setType(String type) {        this.type = type;    }        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 Resource)) {            return false;        }        Resource other = (Resource) 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.Resource[id=" + id + "]";    }}

⌨️ 快捷键说明

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