Parameter does not exist as a named parameter even if well named
<p>I have an issue that i can't solve.</p>

<p>Hibernate shows this :</p>

<pre><code>Parameter targetDate does not exist as a named parameter in [delete from com.inetpsa.stb.model.Journal t where t.date &lt; :targetDate]
</code></pre>

<p>targetDate is set as this :</p>

<pre><code>public int purgeOrSave(String hql, Date targetDate) {
        Query query = getSession().createQuery(hql);
        query.setDate("targetDate", targetDate);
        return query.executeUpdate();
}
</code></pre>

<p>hql is a string containing the query to execute : "delete from com.inetpsa.stb.model.Journal t where t.date &lt; :targetDate"</p>

<p>My entity is well defined. I have tried to suppress the fully qualified name of the entity as this :</p>

<pre><code>delete from Journal t where t.date &lt; :targetDate
</code></pre>

<p>and the result is that hibernate tells me that Journal is not mapped...</p>

<p>Any idea ?</p>

<p>PS : here is the code of Journal:</p>

<pre><code>&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt;
&lt;hibernate-mapping package="com.inetpsa.stb.model" default-lazy="false"&gt;
   &lt;class name="Journal" table="STBQTJEV"&gt;
        &lt;id name="id" type="java.lang.Long" column="JEV_ID"&gt;
          &lt;generator class="native"&gt;
           &lt;param name="sequence"&gt;STBQXJEV&lt;/param&gt;
          &lt;/generator&gt;
        &lt;/id&gt;
        &lt;property name="uuid"           column="JEV_UUID"           type="java.lang.String"/&gt;
        &lt;property name="canal"          column="CAV_CODE"           type="java.lang.String"/&gt;
        &lt;property name="commandeId"     column="CMD_CODE"           type="java.lang.String"/&gt;
        &lt;property name="contratId"      column="CNT_CODE"           type="java.lang.String"/&gt;
        &lt;property name="contratClient"  column="CNT_CONTRAT_CLIENT" type="java.lang.String"/&gt;
        &lt;property name="vin"            column="VCL_VIN"            type="java.lang.String"/&gt;
        &lt;property name="clientCode"     column="CLT_CODE"           type="java.lang.String"/&gt;
        &lt;property name="clientMaile"    column="CLT_MAIL"           type="java.lang.String"/&gt;
        &lt;property name="evenementCode"  column="EVN_CODE"           type="java.lang.String"/&gt;
        &lt;property name="offer"          column="JEV_OFFER"          type="java.lang.String"/&gt;
        &lt;property name="produits"       column="JEV_PDT"            type="java.lang.String"/&gt;        
        &lt;property name="source"         column="JEV_SOURCE"         type="java.lang.String"/&gt;
        &lt;property name="step"           column="JEV_STEP"           type="java.lang.String"/&gt;
        &lt;property name="statut"         column="JEV_STATUT"         type="java.lang.String"/&gt;
        &lt;property name="commentaire"    column="JEV_COM"            type="java.lang.String"/&gt;
        &lt;property name="detail"         column="JEV_DETAIL"         type="java.lang.String"/&gt;
        &lt;property name="date"           column="JEV_DATE"           type="java.util.Date"/&gt;       
        &lt;property name="dateDebut"      column="JEV_DATE_DEBU"      type="java.sql.Timestamp"/&gt;
        &lt;property name="dateFin"        column="JEV_DATE_FIN"       type="java.sql.Timestamp"/&gt;
   &lt;/class&gt;
&lt;/hibernate-mapping&gt;
</code></pre>