2

I have a database with the structure below:

**Dimension_A**
Key_1
Key_2

**Dimension_B**
Key_2
Key_3

**MyTable**
ID
key_1
key_2
key_3

The table Dimension_A has a composite ID made up of key_1 and key_2

The table Dimension_B has a composite ID made up of a field with the same name as in Dimension_A (key_2) and another field (key_3)

I am trying to add a record to the table "MyTable". When doing do I get the error: Invalid index 4 for this SqlParameterCollection with Count = 4

Now I understand that this has to do with the fact that the name of key_2 is duplicated in both tables.

I have no control over the database so cannot change the column names. Is there any way to alias table names when referencing tables in the mapping so that this is no longer a problem?

BTW - I am using Fluent NHibernate to implement this

devprog
  • 285
  • 1
  • 2
  • 10
  • I have a very similar question I posted on SO flow here with no answer as of now: http://stackoverflow.com/questions/7167516/mapping-two-references-in-the-same-class-but-reference-class-has-composite-key I also posted something on the nhusers google groups here http://groups.google.com/group/nhusers/browse_thread/thread/4245b515ae28d3a0 – Cole W Aug 25 '11 at 19:19
  • i have a similar problem posted on SO and with a similar answer as in ColeWs question – Firo Aug 26 '11 at 07:56
  • Do you have any properties mapped? or do you only have related entities mapped? I.E. what does your class look like – cdmdotnet Sep 30 '11 at 00:29
  • Did you look at http://stackoverflow.com/questions/3892194/using-part-of-a-composite-primary-key-in-a-composite-foreign-key-in-nhibernate? – rbellamy Oct 04 '11 at 22:49

0 Answers0