Associative table role name error

Feb 2, 2012 at 8:01 PM

I have made two tables:

Firm

Id - int
Name - varchar

PaymentFirm

ClientId - int
PayFirmId - int

I lay the following relations:

Firm.Id => PaymentFirm.ClientId - rolename: client
Firm.Id => PaymentFirm.PayFirmId - rolename: payfirm

I get two the same errors: the role names for the two incoming relations for the associative table must match

I have changed the role name, I have made them the same, I put no names. Both the roles are defined on the Firm table.

The idea is that one firm can be a production plant, while the other firm (pay firm) is the financial institution that pays most of the bills. (Don't ask me, it's how the industry does it.) Can I put these two firms in a single table and set a reference from this table to the PaymentFirm associative table and back? Or do I need to put one relation in the firm table and one in the payment firm table? Or do both relationships need to be in the associative table?

Any help is appreciated.

Feb 6, 2012 at 5:33 PM

Bump.

Feb 11, 2012 at 9:34 AM

Does anybody know how to fix my problem? I can't find a solution on the internet.

Coordinator
Feb 13, 2012 at 11:38 AM

This does not look right. An associative table is to link a many-to-many relationship. Normally you would have something like Firm, PaymentFirm, and Payment tables. Then Firm.Id->PaymentFirm>FirmId and Payment.Id->PaymentFirm.PaymentId. There is no need to assign a role name since there is only one relation coming from each table. When you generate the Firm entity it will have a PaymentList collection and the Payment entity will have a FirmList collection. If you are not trying to create a many-to-many relationship then do not define an associative table.