please do as the below.

String hql="SELECT p.driverid, p.framestart, p.frameend, p.timestart, p.timeend" +
                    " FROM  TcnrDriverPreference p, TcnrDriver d WHERE (p.driverid=d.driverid) and (d.yardid=:yardid) and " +
                    "(p.timestart<=:timestart) and (p.timeend>=:timeend) ";
        Query query=getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(hql);
        query.setInteger("yardid", yardid);
        query.setTime("timestart", tcnrShift.getTimestart());
        query.setTime("timeend", tcnrShift.getTimeend());
        List<TcnrDriverPreference> list=query.list();
        List<TcnrDriverPreference> tcnrDriverPreferenceList=new ArrayList<TcnrDriverPreference>();
        for(Iterator iterator=list.iterator();iterator.hasNext();) {
            Object[] row=(Object[])iterator.next();
            TcnrDriverPreference tcnrDriverPreference=new TcnrDriverPreference();
            tcnrDriverPreference.setDriverid((Integer)row[0]);
            tcnrDriverPreference.setFramestart((Integer)row[1]);
            tcnrDriverPreference.setFrameend((Integer)row[2]);
            tcnrDriverPreference.setTimestart((Time)row[3]);
            tcnrDriverPreference.setTimeend((Time)row[4]);
           
            tcnrDriverPreferenceList.add(tcnrDriverPreference);
        }