tags:

views:

275

answers:

0

I am using NHibernate and using SchemaExport to generate my entities. I have an entity with one to many relation ship and would like to name the foreign key constraint. I have this article as a references but it talks about a many to one. When I put use the Foreign-key attibute on the 'key' element, I get a error that says the table already exists.

The reference article

And excerpt from my mapping.

  <bag name="Items" lazy="false" access="field.camelcase-underscore"  
       cascade="save-update" order-by ="seq">
      <key column="ValueSetId" foreign-key="FK_ValueSet_To_ValueSetItem"  />     
      <one-to-many class="XXX.Tools.Core.Entities.ValueSetItem, XXX.Tools.Core"                   
                    />
    </bag>