📄 tag.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -