Skip to content

Instantly share code, notes, and snippets.

@nemo83
Created March 30, 2013 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemo83/5276329 to your computer and use it in GitHub Desktop.
Save nemo83/5276329 to your computer and use it in GitHub Desktop.
@Entity
@Table(name ="product")
public class Product {
private Integer id;
private String name;
private List<ProductItem> productItems =new LinkedList<ProductItem>();
public Product() {
}
@Id
@GenericGenerator(name ="generator", strategy ="increment")
@GeneratedValue(generator ="generator")
@Column(name ="product_id", nullable =false)
public Integer getId() {
returnthis.id;
}
publicvoid setId(Integer id) {
this.id = id;
}
@Column(name ="name")
public String getName() {
returnthis.name;
}
publicvoid setName(String name) {
this.name = name;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy ="pk.product")
public List<ProductItem> getProductItems() {
returnthis.productItems;
}
publicvoid setProductItems(List<ProductItem> productItems) {
this.productItems = productItems;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment