Hello again,
I have tried
Code:
NHibernate.Cfg.Configuration cfg = GetFullyConfigured(...);
new NHibernate.Tool.hbm2ddl.SchemaExport(cfg).Create(true, true);
on a sample i downloaded from [url=http://weblogs.asp.net/pwilson/archive/2005/05/26/409042.aspx] wilson sample
[/url]
its hbm.xml file contains many-to-many relation as the following [i trimmed some fields for simplicity]
Code:
<class name="Wilson.NHibernate.Example.Category, WilsonNHibernateExample" table="Categories">
<id name="Id" column="CategoryId">
<generator class="assigned" />
</id>
<bag name="Contacts" table="CategoryContacts" cascade="none" access="nosetter.camelcase" lazy="false" inverse="true">
<key column="CategoryId" />
<many-to-many column="ContactID" class="Wilson.NHibernate.Example.Contact, WilsonNHibernateExample" />
</bag>
</class>
<class name="Wilson.NHibernate.Example.Contact, WilsonNHibernateExample" table="Contacts" discriminator-value="?" >
<id name="Id" column="ContactId" access="nosetter.camelcase" unsaved-value="0">
<generator class="identity" />
</id>
<bag name="Categories" table="CategoryContacts" cascade="none" access="nosetter.camelcase" lazy="false" inverse="false">
<key column="ContactId" />
<many-to-many column="CategoryId" class="Wilson.NHibernate.Example.Category, WilsonNHibernateExample" />
</bag>
</class>
This xml generates
Code:
create table CategoryContacts (
CategoryId NVARCHAR(255) not null,
ContactID INT null,
ContactId INT not null
)
which causes an error clearly because of the duplicate column name.
This is caused that the column is generated twice from both the decalaratins in the two classes ,,
how to overcome this error ?
or what am i missing ?