Hibernate version: 
3.0
Mapping documents:
Code:
<hibernate-mapping>
  <class table="document" name="com.xxx.Document" proxy="com.xxx.Document">
    <id name="id" type="long" column="idDocument">
      <generator class="increment"/>
    </id>
    <set cascade="all" lazy="true" name="extractionSections">
      <key column="idDocument" not-null="true" foreign-key="documentIdx"/>
      <one-to-many class="com.xxx.ExtractionSection"/>
    </set>
  </class>
</hibernate-mapping>
Name and version of the database you are using:MySQL 4.1
The generated SQL (show_sql=true):Code:
select parentfeat8_.idParentFeature as col_0_0_, feature1_.idFeature as col_1_0_, feature1_.featureName as col_2_0_ from document document0_ inner join extractionsection extraction2_ on document0_.idDocument=extraction2_.idDocument inner join extraction extraction3_ on extraction2_.idExtraction=extraction3_.idExtraction inner join section section4_ on extraction2_.idSection=section4_.idSection inner join positionedfeature pparentFeatureositioned5_ on extraction2_.idExtractionSection=positioned5_.idExtractionSection inner join feature feature6_ on positioned5_.idFeature=feature6_.idFeature inner join featureHierarchy parentfeat7_ on feature6_.idFeature=parentfeat7_.idFeature, feature feature1_ inner join featureHierarchy parentfeat8_ on feature1_.idFeature=parentfeat8_.idFeature where document0_.idDocument=? and feature1_.idFeature=parentfeat7_.idParentFeature and parentfeat8_.idParentFeature=?
Code used:Code:
          String query = "SELECT rpfeat.parentFeature.id, rfeat.id, rfeat.name, false " +
          "FROM Document document " +
          ", Feature rfeat " +
          "JOIN document.extractionSections exsec " +
          "JOIN exsec.extraction ex " +
          "JOIN exsec.section as sec " +
          "JOIN exsec.positionedFeatures as pfeat " +
          "JOIN pfeat.feature as feat " +
          "JOIN feat.parentFeatures as parents " +
          "JOIN rfeat.parentFeatures as rpfeat " +
          "WHERE document.id=? " +
          "AND rfeat.id = parents.parentFeature.id " +
          "AND rpfeat.parentFeature=? ";
          Query q = getSession().createQuery(query);
          q.setLong(0, 73l);
          q.setLong(1, 5684911768528200454l);
          q.list();
Problem: When I build my query, if I use 
Code:
"idDocument=73" 
it does work (I get some results)
but if I use:
Code:
"idDocument=?" 
and 
Code:
"query.setLong(0, 73l)"
it does not work anymore (I get an empty set)
If I execute the generated SQL directly in a MySQL console, everything is ok. And I do use another parameter (parentFeature) which works perfectly.
Could someone explain me what I did wrong ? 
Thanks in advance.