Hi,

Is property-ref supposed to work with many-to-many?
I tried to use it(I know it is not the best practice but it's a legacy
database), and I get the following exception :

 System.Collections.Generic.KeyNotFoundException: La clé donnée était
absente du dictionnaire.
   à System.ThrowHelper.ThrowKeyNotFoundException()
   à System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   à
NHibernate.Persister.Entity.AbstractEntityPersister.GetAppropriateUniqueKeyLoader
(String propertyName, IDictionary`2 enabledFilters)
   à
NHibernate.Persister.Entity.AbstractEntityPersister.LoadByUniqueKey
(String propertyName, Object uniqueKey, ISessionImplementor session)
   à NHibernate.Type.EntityType.LoadByUniqueKey(String entityName,
String uniqueKeyPropertyName, Object key, ISessionImplementor
session)

I have the following mappings :

<class name="OffreComplete" table="OffreComplete" >
    <id name="Id" column="OffreCompleteId" type="Int32" unsaved-
value="null">
      <generator class="native"/>
    </id>
    <set name="Sites" table="OffreCompleteSite" cascade="all-delete-
orphan">
      <key column="OffreCompleteId"/>
      <many-to-many column="SiteCd" property-ref="Code" class="Site"/>
    </set>
</class>
<class name="Site" table="Site"  >
    <id name="Id" column="SiteId" type="Int32" unsaved-value="null">
      <generator class="native"/>
    </id>
    <property name="Nom" column="Nom" />
    <property name="Code" column="SiteCd" unique="true"/>
    <property name="Niveau" column="NiveauId" />
</class>

Is it possible to do it at all ?
Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to