This is a project used to find a corresondin location from place
源代码在线查看: shop.java
/* * Shop.java * * Created on Apr 5, 2008, 10:08:46 AM * * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.horizongroup.mcompanion.web.model; import java.io.Serializable; import java.util.Collection; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author User */ @Entity @Table(name = "shop") @NamedQueries({@NamedQuery(name = "Shop.findByShopId", query = "SELECT s FROM Shop s WHERE s.shopId = :shopId"), @NamedQuery(name = "Shop.findByShopName", query = "SELECT s FROM Shop s WHERE s.shopName = :shopName"), @NamedQuery(name = "Shop.findByShopType", query = "SELECT s FROM Shop s WHERE s.shopType = :shopType"), @NamedQuery(name = "Shop.findByShopAbout", query = "SELECT s FROM Shop s WHERE s.shopAbout = :shopAbout"), @NamedQuery(name = "Shop.findByFacilities", query = "SELECT s FROM Shop s WHERE s.facilities = :facilities")}) public class Shop implements Serializable { @Id @Column(name = "shop_id", nullable = false) private Integer shopId; @Column(name = "shop_name", nullable = false) private String shopName; @Column(name = "shop_type", nullable = false) private String shopType; @Column(name = "shop_about") private String shopAbout; @Column(name = "facilities") private String facilities; @JoinColumn(name = "address_id", referencedColumnName = "address_id") @ManyToOne private Address addressId; @OneToMany(cascade = CascadeType.ALL, mappedBy = "shopId") private Collection shopItemCollection; public Shop() { } public Shop(Integer shopId) { this.shopId = shopId; } public Shop(Integer shopId, String shopName, String shopType) { this.shopId = shopId; this.shopName = shopName; this.shopType = shopType; } public Integer getShopId() { return shopId; } public void setShopId(Integer shopId) { this.shopId = shopId; } public String getShopName() { return shopName; } public void setShopName(String shopName) { this.shopName = shopName; } public String getShopType() { return shopType; } public void setShopType(String shopType) { this.shopType = shopType; } public String getShopAbout() { return shopAbout; } public void setShopAbout(String shopAbout) { this.shopAbout = shopAbout; } public String getFacilities() { return facilities; } public void setFacilities(String facilities) { this.facilities = facilities; } public Address getAddressId() { return addressId; } public void setAddressId(Address addressId) { this.addressId = addressId; } public Collection getShopItemCollection() { return shopItemCollection; } public void setShopItemCollection(Collection shopItemCollection) { this.shopItemCollection = shopItemCollection; } @Override public int hashCode() { int hash = 0; hash += (shopId != null ? shopId.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 Shop)) { return false; } Shop other = (Shop) object; if ((this.shopId == null && other.shopId != null) || (this.shopId != null && !this.shopId.equals(other.shopId))) { return false; } return true; } @Override public String toString() { return "com.horizongroup.mcompanion.web.model.Shop[shopId=" + shopId + "]"; } }