Java tutorial
/* * Copyright 2005-2013 shopxx.net. All rights reserved. * Support: http://www.shopxx.net * License: http://www.shopxx.net/license */ package net.groupbuy.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonProperty; /** * Entity - ? * * @author SHOP++ Team * @version 3.0 */ @Entity @Table(name = "xx_gift_item", uniqueConstraints = { @UniqueConstraint(columnNames = { "gift", "promotion" }) }) @SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_gift_item_sequence") public class GiftItem extends BaseEntity { private static final long serialVersionUID = 6593657730952481829L; /** ? */ private Integer quantity; /** ? */ private Product gift; /** */ private Promotion promotion; /** * ?? * * @return ? */ @JsonProperty @NotNull @Min(1) @Column(nullable = false) public Integer getQuantity() { return quantity; } /** * ? * * @param quantity * ? */ public void setQuantity(Integer quantity) { this.quantity = quantity; } /** * ?? * * @return ? */ @JsonProperty @NotNull @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, updatable = false) public Product getGift() { return gift; } /** * ? * * @param gift * ? */ public void setGift(Product gift) { this.gift = gift; } /** * ? * * @return */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, updatable = false) public Promotion getPromotion() { return promotion; } /** * * * @param promotion * */ public void setPromotion(Promotion promotion) { this.promotion = promotion; } }