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 java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.NotEmpty; import com.fasterxml.jackson.annotation.JsonProperty; /** * Entity - ? * * @author SHOP++ Team * @version 3.0 */ @Entity @Table(name = "xx_parameter_group") @SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_parameter_group_sequence") public class ParameterGroup extends OrderEntity { private static final long serialVersionUID = 192003501177471941L; /** ?? */ private String name; /** */ private ProductCategory productCategory; /** ? */ private List<Parameter> parameters = new ArrayList<Parameter>(); /** * ??? * * @return ?? */ @JsonProperty @NotEmpty @Length(max = 200) @Column(nullable = false) public String getName() { return name; } /** * ?? * * @param name * ?? */ public void setName(String name) { this.name = name; } /** * ? * * @return */ @NotNull @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false) public ProductCategory getProductCategory() { return productCategory; } /** * * * @param productCategory * */ public void setProductCategory(ProductCategory productCategory) { this.productCategory = productCategory; } /** * ?? * * @return ? */ @JsonProperty @Valid @NotEmpty @OneToMany(mappedBy = "parameterGroup", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) @OrderBy("order asc") public List<Parameter> getParameters() { return parameters; } /** * ? * * @param parameters * ? */ public void setParameters(List<Parameter> parameters) { this.parameters = parameters; } }