I am trying to model this relationship following this link http://www.javaworld.com/javaworld/jw-01-2008/images/datamodel.gif
Its the usual Many to Many relationship between Order and Products but I dont know how to add the extra columns in the Join table.
@Entity
@Table(name = "Orders")
public class Order {
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "ORDER_LINES", joinColumns = { @JoinColumn(name = "ORDER_ID") }, inverseJoinColumns = { @JoinColumn(name = "PROD_ID") })
private Set<Product> products;
}
@Entity
@Table(name="PRODUCTS")
public class Product {
@ManyToMany(mappedBy="products")
private Set<Order> orders;
}
How to add Join Table extra attribute in JPA 2.0?
Thanks