tag.java

来自「用struts2+jpa来实现了对音乐」· Java 代码 · 共 62 行

JAVA
62
字号
package net.jeffrey.hibernate;import java.io.Serializable;import java.util.ArrayList;import java.util.List;import javax.persistence.Entity;import javax.persistence.ManyToMany;/** * 商品标签 * @author jeffrey */@Entitypublic class Tag extends AbstractEntity implements Serializable {    private String name;        @ManyToMany(mappedBy = "tags")    private List<Product> products = new ArrayList<Product>();        public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public List<Product> getProducts() {        return products;    }    public void setProducts(List<Product> products) {        this.products = products;    }        @Override    public String toString() {        return "Tag[" + id + "," + name + "]";    }    @Override    public boolean equals(Object obj) {        if (obj == null) {            return false;        }        if (getClass() != obj.getClass()) {            return false;        }        final Tag other = (Tag) obj;        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {            return false;        }        return true;    }    @Override    public int hashCode() {        int hash = 7;        return hash = 47 * hash + id;    }}

⌨️ 快捷键说明

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