I figured out the problem, but not the solution.

Here's the problem:

I have a uni-directional Collection in my Invoice:

@Entity class Invoice {
  | 
  |    @OneToMany Collection<Product> getProducts();
  | 
  | }

This results in creating a join table, with a unique constraint on the 
product_id column, which doesn't work because the Collection can have the same 
Product multiple times.

The naive solution would be a table that looks like:

invoice_id    product_id
  | 33                   88
  | 33                   88

But that's not a proper relation.  Rows (tuples) must be unique.

What is needed is a third column, which is a row ID.  I can't see anything in 
the docs about how I could do that.  Any suggestions?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016694#4016694

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016694
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to