📄 goodscategory.java
字号:
/* * GoodsCategory.java * * Created on 2007-6-1, 14:22:21 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package com.studio009.store.entity;import java.io.Serializable;import java.util.Collection;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.OneToMany;import javax.persistence.Table;/** * 商品分类实体类 * <p> * 该类对应数据库的表, * 数据库每个字段可以找到一个属性. * 详情参加数据库设计书. * </p> * @see Goods * @author wangs */@Entity@Table(name = "goodscategory")@NamedQueries( {@NamedQuery(name = "GoodsCategory.findByGoodsCategoryID", query = "SELECT g FROM GoodsCategory g WHERE g.goodsCategoryID = :goodsCategoryID"), @NamedQuery(name = "GoodsCategory.findByGoodsCategoryName", query = "SELECT g FROM GoodsCategory g WHERE g.goodsCategoryName = :goodsCategoryName")})public class GoodsCategory implements Serializable { @Id @Column(name = "goodsCategoryID", nullable = false) @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer goodsCategoryID; @Column(name = "goodsCategoryName", nullable = false) private String goodsCategoryName; @OneToMany(cascade = CascadeType.ALL, mappedBy = "goodsCategoryID") private Collection<Goods> goodsCollection; public GoodsCategory() { } public GoodsCategory(Integer goodsCategoryID) { this.goodsCategoryID = goodsCategoryID; } public GoodsCategory(Integer goodsCategoryID, String goodsCategoryName) { this.goodsCategoryID = goodsCategoryID; this.goodsCategoryName = goodsCategoryName; } public Integer getGoodsCategoryID() { return goodsCategoryID; } public void setGoodsCategoryID(Integer goodsCategoryID) { this.goodsCategoryID = goodsCategoryID; } public String getGoodsCategoryName() { return goodsCategoryName; } public void setGoodsCategoryName(String goodsCategoryName) { this.goodsCategoryName = goodsCategoryName; } public Collection<Goods> getGoodsCollection() { return goodsCollection; } public void setGoodsCollection(Collection<Goods> goodsCollection) { this.goodsCollection = goodsCollection; } @Override public int hashCode() { int hash = 0; hash += (goodsCategoryID != null ? goodsCategoryID.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 GoodsCategory)) { return false; } GoodsCategory other = (GoodsCategory) object; if (this.goodsCategoryID != other.goodsCategoryID && (this.goodsCategoryID == null || !this.goodsCategoryID.equals(other.goodsCategoryID))) { return false; } return true; } @Override public String toString() { return "com.studio009.store.entity.GoodsCategory[goodsCategoryID=" + goodsCategoryID + "]"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -