views:

13

answers:

1

Is there a way from preventing SchemaExport from generating a foreign key constraint on mapping type? I saw a similar question about mapping, but unfortunately that wont do for . I couldn't find answer to this in NHibernate reference, but maybe someone knows a trick? I'd like to avoid removing constraint afterwards.

A: 

Could you post your mappings? <any> definitely does not create foreign keys.

Example:

<any id-type="Guid" meta-type="Int32" name="FooBarOrBaz">
  <meta-value value="1" class="Foo" />
  <meta-value value="2" class="Bar" />
  <meta-value value="3" class="Baz" />
  <column name="FooBarOrBazId" />
  <column name="FooBarOrBazType" />
</any>

This will just create two columns (FooBarOrBazId and FooBarOrBazType), with no FKs

Diego Mijelshon
You are right, I'm sorry I wasted your time. It was created by reverse mappings. Now I have to go back to few other places where I asked the question and apologize too :)
Nikola