I am having trouble trying to map this object that contains a collection of guids. I have the mapping working with no errors, however I keep getting empty guids inserted into OrganizationId in the OrganizationAdvertistments table. I was wondering how to map this set correctly?
<?xml version="1.0" encoding="utf-8" ?>
<class name="Advertisement" table="Advertisement" lazy="false">
<id name="Id">
<generator class="guid"></generator>
</id>
<property name="DateStart"/>
<property name="DateExpired"/>
<property name="Title"/>
<property name="Body"/>
<set name="OrganzationIds" table="OrganizationAdvertisements" lazy="true">
<key>
<column name="AdvertisementId"></column>
</key>
<element column="OrganizationId" type="Guid" />
</set>
</class>
Are you gonna have many to many relationship between Advertistment and Organization? if yes you’ve got had another class: Organization and set many to many relationship between these two classes and there is no need to map OrganzationIds. Your class would be somthing like this:
and your map: