Skip to content

Instantly share code, notes, and snippets.

@ogrigas
Created March 29, 2014 13:49
Show Gist options
  • Save ogrigas/9854811 to your computer and use it in GitHub Desktop.
Save ogrigas/9854811 to your computer and use it in GitHub Desktop.
@Entity
@Table(name = "orders", schema = "com"})
public class Order implements Serializable {
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "order_seq")
@Column(name = "ID", unique = true, nullable = false)
private Integer id;
@Column(name = "NUMBER", nullable = false, length = 8)
private String number;
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "order_items", catalog = "com",
joinColumns = {@JoinColumn(name = "ORDER_ID",
updatable = false, nullable = false)},
inverseJoinColumns = {@JoinColumn(name = "ITEM_ID",
updatable = false, nullable = false)})
private Set<Item> items = new HashSet<Item>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment