Bonjour,

J'essaye de mapper une collection (AdditionalLinksList) avec plusieurs clé. Le problème (assez étonnant) est que j'arrive à sauvegarder des données mais pas a les charger...

Mapping :

Code xml :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="OPS_OREO.OREO.OPOP.DataModel"
                   assembly="OPS_OREO">
  <class name="RDS" table="OPOP_RDS" lazy="false">
    <composite-id>
      <key-property name="rangeId">
        <column name="id" sql-type="integer" not-null="true"/>
      </key-property>
      <key-property name="localisationId">
        <column name="localizationId" sql-type="integer" not-null="true"/>
      </key-property>
    </composite-id>
    <property name="name" column="name" />
    <property name="shortDescription" column="shortDesc" />
    <property name="longDescription" column="longDesc" />
    <property name="presentation" column="presentation" />
    <property name="benefits" column="benefits" />
    <property name="published" column="published" type="boolean" />
    <property name="softwareRegistration" column="softwareRegistration" type="boolean" />
    <property name="productSelector" column="productSelector" />
    <property name="productConfigurator" column="productConfigurator" />
    <many-to-one name="localisation" column="localizationId" class="Localization"/>
 
    <bag name="AdditionalLinksList" table="OPOP_AdditionalLinksRDS" lazy="false" cascade="all">
      <key>
        <column name="rangeId"/>
        <column name="localizationId"/>
      </key>
      <many-to-many class="AdditionalLinks" column="AdditionalLinkId" not-found="ignore" />
    </bag>
  </class>
</hibernate-mapping>

table d'association "OPOP_AdditionalLinksRDS" :
Code sql :
1
2
3
4
5
6
7
create table OPOP_ADDITIONALLINKSRDS (
   RANGEID              int                  not null,
   LOCALIZATIONID       int                  not null,
   ADDITIONALLINKID     int                  not null,
   constraint PK_OPOP_ADDITIONALLINKSRDS primary key (RANGEID, LOCALIZATIONID, ADDITIONALLINKID)
)
go

Requête générée :
Code sql :
1
2
3
4
5
6
7
8
9
10
11
12
SELECT additional0_.rangeId as rangeId1_, 
additional0_.localizationId as localiza2_1_, 
additional0_.AdditionalLinkId as Addition3_1_, 
additional1_.Id as Id12_0_, 
additional1_.label as label12_0_, 
additional1_.URL as URL12_0_, 
additional1_.target as target12_0_ 
FROM OPOP_AdditionalLinksRDS additional0_ 
left outer join OPOP_AdditionalLinks additional1_ on additional0_.AdditionalLinkId=additional1_.Id 
WHERE additional0_.rangeId=@p0 
and additional0_.localizationId=@p1
;@p0 = 2455 [Type: Int32 (0)], @p1 = 120 [Type: Int32 (0)]

Mais en exécutant la requête dans SQLServer ManagementStudio, il me retourne des résultats...
Quelqu'un aurait une idée ?