Cannot convert 17/04/16 00:00 of type class java.util.Date to class java.sql.Date
<p>I'm trying to recuperate a list of data from my DB that depends on the date "datJourCchn" ; </p>

<p>I cloudn't find where is the error;
PS: I changed the Date imports to java.sql.Date instead of java.util.Date  </p>

<p>here is  my code:</p>

<h2>CoursChangeDaoImpl</h2>

<pre><code> @Override
 public List&lt;CoursChange&gt; getAllCoursParDate(Date datJourCchn)
 {
     System.out.println("date-------------&gt;" + datJourCchn);
     List&lt;CoursChange&gt; coursChanges =new ArrayList&lt;CoursChange&gt;();
     Devise devise =new Devise();
    Connection conn = null;
    String sql=
             "SELECT d.LIB_DEV_DEV , d.LIB_SIGL_DEV , c.DAT_JOUR_CCHN , c.COD_ETAT_CCHN , c.MONT_CABA_CCHN , c.MONT_CABC_CCHN  , c.MONT_CVBA_CCHN , c.MONT_CVBC_CCHN  ,c.TIME_CCHN ,c.ID_COURS_CHANGE   FROM COURS_CHANGE c , DEVISE d  where c.COD_DEV_DEV=d.COD_DEV_DEV and c.DAT_JOUR_CCHN=?";

    System.out.println("date-------------&gt;" + datJourCchn);

    try
     {
         conn =  dataSource.getConnection();
         PreparedStatement ps = conn.prepareStatement(sql);
         ps.setDate(1,  datJourCchn);
         ResultSet rs=ps.executeQuery();
        while(rs.next())
         { CoursChange coursChange =new CoursChange();
                coursChange.setIdCoursChange(rs.getInt("ID_COURS_CHANGE"));
                 coursChange.setCodEtatCchn(rs.getString("COD_ETAT_CCHN"));
                 coursChange.setMontCabaCchn(rs.getFloat("MONT_CABA_CCHN"));
                 coursChange.setMontCabcCchn(rs.getFloat("MONT_CABC_CCHN"));
                 coursChange.setMontCvbaCchn(rs.getFloat("MONT_CVBA_CCHN"));
                 coursChange.setMontCvbcCchn(rs.getFloat("MONT_CVBC_CCHN"));
                 devise.setLibDevDev(rs.getString("LIB_DEV_DEV"));
                 devise.setLibSiglDev(rs.getString("LIB_SIGL_DEV")); 
                 coursChange.setDatJourCchn(rs.getDate("DAT_JOUR_CCHN"));
                 coursChange.setTimeCchn(rs.getString("TIME_CCHN"));
                 System.out.println(rs.getInt("ID_COURS_CHANGE"));
                 System.out.println(rs.getString("LIB_DEV_DEV"));
                 coursChanges.add(coursChange );
         }
         rs.close();
         ps.close();
     }
     catch(Exception e)

     {



        throw new RuntimeException(e); 
     }

     finally
     {
         try
         {
             conn.close();
         }
         catch(SQLException e)
         {

         }
     }
    return  coursChanges;
    }
</code></pre>

<h2>page.xhtml</h2>

<pre><code>&lt;p:calendar id="button" value="#{coursChangeCtr.datJourCchn}"
            showOn="button" pattern="MM-dd-yy"&gt;

        &lt;/p:calendar&gt;


        &lt;p:commandButton value="submit"
            action="#{coursChangeCtr.listCoursPreparedStatement()}" update="AjoutTab" /&gt;


        &lt;p:dataTable value="#{coursChangeCtr.listCoursPreparedStatement()}" var="cours"
            id="AjoutTab" emptyMessage="aucune info!!" rows="5"
            style="width:1000px;font-size:13px;margin-left: 25px"&gt;
</code></pre>

<h2>the error is:</h2>

<pre><code>Cannot convert 17/04/16 00:00 of type class java.util.Date to class java.sql.Date
</code></pre>