I use the following mapping file to map a join table "VXLucieProduitLotProjet_NEW" wich used to retrive the many to many association between "VXLucieProjetLotProjet" and "VXLucieProduit".
If I don't use a subselect into the join tag, I have the errors :
could not execute query
no data found
But if I run myself the generated request on the database, there are results.
When I add a subselect wich return the content of table specified in the join element (like in following mapping file) , the problem disappear.
I don't think that is normal, is it?
<class name="com.apis.cz.donnees.mapping.JADE.ProduitLotProjet" table="VXLucieProduitLotProjet_NEW" lazy="false" >
<composite-id name="id" class="com.apis.cz.donnees.mapping.JADE.ProduitLotProjetId">
<key-property name="produit" type="string">
<column name="Produit2" />
</key-property>
<key-property name="projet" type="string">
<column name="Projet" />
</key-property>
</composite-id>
<property name="statut" type="string">
<column name="Statut" length="10"/>
</property>
.... other properties ...
<join table="VXLucieProduitLotProjet_NEW" inverse="true" optional="true" >
<subselect>
select * from VXLucieProduitLotProjet_NEW
</subselect>
<key>
<column name="Produit2" />
<column name="Projet"/>
<column name="Lot"/>
</key>
<many-to-one
name="produit"
column="Produit2"
update="false" insert="false" fetch="select" lazy="false"
not-null="true"/>
<many-to-one name="projet" ...../>
</join>
</class>
</hibernate-mapping>
|