template.java
来自「EJB3 Annotation Sample」· Java 代码 · 共 142 行
JAVA
142 行
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.s7turn.content.entities;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 = "templates" )@NamedQueries({ @NamedQuery( name = "Template.findAllTemplates", query="SELECT t FROM Template t"), @NamedQuery( name = "Template.findTemplateById", query="SELECT t FROM Template t WHERE t.id=:id"), @NamedQuery( name = "Template.findByChannel", query="SELECT t FROM Template t WHERE t.channel=:channel")})public class Template implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name="template_id") private Long id; //@JoinColumn(name="category_id") //private Category category; @JoinColumn(name="channel_id") private Channel channel; //@JoinColumn(name="sub_category_id") //private SubCategory subCategory; @Column(name="template_url") private String templateUri; @Column(name="template_desc") private String description; @Column(name="template_name") private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } 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; }/* public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; }*/ public Channel getChannel() { return channel; } public void setChannel(Channel channel) { this.channel = channel; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } /* public SubCategory getSubCategory() { return subCategory; } public void setSubCategory(SubCategory subCategory) { this.subCategory = subCategory; }*/ public String getTemplateUri() { return templateUri; } public void setTemplateUri(String templateUri) { this.templateUri = templateUri; } @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 Template)) { return false; } Template other = (Template) 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.content.entities.Template[id=" + id + "]"; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?