[jboss-user] [EJB 3.0] - Using a JoinTable, getting unique constraint violtions
SmokingAPipe
do-not-reply at jboss.com
Wed Feb 14 15:53:39 EST 2007
Let's say I'm making an accounting system. I have Invoices, and on Invoices I have Products. Every invoice can have a set of one or more products, and there could be duplicates. Every product could show up on any number of invoices. The relationship is uni-directional. The Product doesn't need to have a collection of Invoices that contain it.
How do I map this?
It seems like what I need is a JoinTable specification, but when I create it, I get a table with a unique constraint on invoice_id. That should not be the case; I should be able to use that invoice_id multiple times to be able to specify a set of products.
What I need is a join table that would look like this:
| invoice_id product_id
| 33 58
| 33 37
| 33 962
|
but it's failing on the uniqueness constraint of invoice_id. Any ideas on how to specify this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016620#4016620
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016620
More information about the jboss-user
mailing list