All my mappings files where generated with middleGen. Here is the mapping file for TrainRame
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
    
<hibernate-mapping>
<!-- 
    Created by Middlegen Hibernate plugin
    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->
<class 
    name="com.thalys.localys.model.TrainRame" 
    table="TRAIN_RAME"
>
    <composite-id name="comp_id" class="com.thalys.localys.model.TrainRamePK">
        <!-- bi-directional many-to-one association to Rame -->
        <key-many-to-one
           name="rame"
           class="com.thalys.localys.model.Rame"
       >
           <column name="NUM_RAME" />
       </key-many-to-one>
        <!-- bi-directional many-to-one association to Train -->
        <key-many-to-one
           name="train"
           class="com.thalys.localys.model.Train"
       >
           <column name="CPT_TRAIN" />
       </key-many-to-one>
    </composite-id>    
    <property
        name="menant"
        type="int"
        column="MENANT"
        length="1"
    />
    <property
        name="orientation"
        type="java.lang.String"
        column="ORIENTATION"
        length="10"
    />
    <property
        name="inversion"
        type="boolean"
        column="INVERSION"
        length="1"
    />
    <property
        name="userAckInversion"
        type="boolean"
        column="USER_ACK_INVERSION"
        length="1"
    />
    <property
        name="distante"
        type="java.lang.String"
        column="DISTANTE"
        length="40"
    />
    <!-- associations -->
</class>
</hibernate-mapping>
The mapping for Train:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
    
<hibernate-mapping>
<!-- 
    Created by Middlegen Hibernate plugin
    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->
<class 
    name="com.thalys.localys.model.Train" 
    table="TRAIN"
>
    <id
        name="cptTrain"
        type="int"
        column="CPT_TRAIN"
    >
        <generator class="sequence">
            <param name="sequence">sequence_cpt_train</param>
        </generator>
    </id>
    <property
        name="startDate"
        type="java.sql.Timestamp"
        column="START_DATE"
        not-null="true"
        length="7"
    />
    <property
        name="stopDate"
        type="java.sql.Timestamp"
        column="STOP_DATE"
        length="7"
    />
    <property
        name="wrongMission"
        type="boolean"
        column="WRONG_MISSION"
        not-null="true"
        length="1"
    />
    <property
        name="userAckWrongMission"
        type="boolean"
        column="USER_ACK_WRONG_MISSION"
        length="1"
    />
    <!-- associations -->
    <!-- bi-directional many-to-one association to Trajet -->
    <many-to-one
        name="trajet"
        class="com.thalys.localys.model.Trajet"
        not-null="true"
    >
        <column name="CPT_TRAJET" />
    </many-to-one>
    <!-- bi-directional one-to-many association to Variation -->
    <set
        name="variations"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAIN" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Variation"
        />
    </set>
    <!-- bi-directional one-to-many association to Status -->
    <set
        name="status"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAIN" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Status"
        />
    </set>
    <!-- bi-directional one-to-many association to Devoiement -->
    <set
        name="devoiements"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAIN" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Devoiement"
        />
    </set>
    <!-- bi-directional one-to-many association to TrainRame -->
    <set
        name="trainRames"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAIN" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.TrainRame"
        />
    </set>
</class>
</hibernate-mapping>
and finally the mapping for Trajet:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
    
<hibernate-mapping>
<!-- 
    Created by Middlegen Hibernate plugin
    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->
<class 
    name="com.thalys.localys.model.Trajet" 
    table="TRAJET"
>
    <id
        name="cptTrajet"
        type="int"
        column="CPT_TRAJET"
    >
        <generator class="sequence">
            <param name="sequence">sequence_cpt_trajet</param>
        </generator>
    </id>
    <property
        name="circulation"
        type="int"
        column="CIRCULATION"
        not-null="true"
        length="5"
    >
        <meta attribute="use-in-tostring">true</meta>
    </property>
    <property
        name="startDate"
        type="java.sql.Timestamp"
        column="START_DATE"
        not-null="true"
        length="7"
    >
        <meta attribute="use-in-tostring">true</meta>
    </property>
    <property
        name="stopDate"
        type="java.sql.Timestamp"
        column="STOP_DATE"
        not-null="true"
        length="7"
    >
        <meta attribute="use-in-tostring">true</meta>
    </property>
    <!-- associations -->
    <!-- bi-directional many-to-one association to AxeRelation -->
    <many-to-one
        name="axeRelation"
        class="com.thalys.localys.model.AxeRelation"
        not-null="true"
    >
        <column name="CPT_AXE" />
    </many-to-one>
    <!-- bi-directional one-to-many association to Horaire -->
    <set
        name="horaires"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAJET" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Horaire"
        />
    </set>
    <!-- bi-directional one-to-many association to Mission -->
    <set
        name="missionsByCptTrajet1"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAJET1" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Mission"
        />
    </set>
    <!-- bi-directional one-to-many association to Mission -->
    <set
        name="missionsByCptTrajet2"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAJET2" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Mission"
        />
    </set>
    <!-- bi-directional one-to-many association to Train -->
    <set
        name="trains"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="CPT_TRAJET" />
        </key>
        <one-to-many 
            class="com.thalys.localys.model.Train"
        />
    </set>
</class>
</hibernate-mapping>
When I run the query with only 'trainRame.comp_id.train.trajet.circulation = ? ' in my where clause. Everything is OK but if I add 'trainRame.comp_id.train.trajet.circulation.startDate >= ? and  and 'trainRame.comp_id.train.trajet.circulation.stopDate <= ?', It fails.
If somebody has an idea of the problem??