title: The data types datetime and time are incompatible in the greater than or equal to operator
body: <p>I have a variable type time in a column of a table of the database.
  How can I compare this value in java with this field I mean can i use date, gregoriancalendar?
  I've tried adn I still have this message, please can someone give me an advice</p>
  
  <pre><code>Date d2 = new Date();                      // timestamp now
  Calendar cal = Calendar.getInstance();       // get calendar instance
  cal.setTime(d2);                           // set cal to date
  cal.set(Calendar.HOUR_OF_DAY, 10);            // set hour to midnight
  cal.set(Calendar.MINUTE, 30);                 // set minute in hour
  cal.set(Calendar.SECOND, 0);                 // set second in minute
  cal.set(Calendar.MILLISECOND, 0);            // set millis in second
  Date d3 = cal.getTime();   
  
  @SuppressWarnings("unchecked")
  List&lt;Asistencia&gt; list = (List&lt;Asistencia&gt;) sessionFactory
  .getCurrentSession()
  .createQuery(
          "select new Asistencia( asis.idAsistencia,"
          + "asis.horaInicio, asis.horaFin) "
          + "from Asistencia asis "
          + "where :hour &gt;= asis.horaInicio and :hour &lt;= asis.horaFin")
  
  .setParameter("hour", d3).list();
  </code></pre>
  
  <p>I also used between </p>
  
  <pre><code>where :hour between asis.horaInicio and asis.horaFin
  </code></pre>
  
  <p>and the mesage is the same:</p>
  
  <pre><code>ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - The data types datetime and time are incompatible in the greater than or equal to operator.
  </code></pre>
  
  <p>The data types datetime and time are incompatible in the greater than or equal to operator.</p>
  
  <p>Here the class Asistencia:</p>
  
  <pre><code>public class Asistencia implements java.io.Serializable {
  
  private static final long serialVersionUID = 1L;
  private long idAsistencia;
      private Date horaInicio;
      private Date horaFin;
      private int idAula;
      private int idCurso;
      private int idPeriodo;
      private Date fecha;
  
      public Asistencia (){
      }
      public Asistencia (long idAsistencia, Date horaInicio, Date horaFin){
            this.idAsistencia
            this.horaInicio = horaInicio;
            this.horaFin = horaFin;
      }
  </code></pre>
  
  <p>}</p>