Session session = HibernateSessionFactory.getSession();
try {                        String hql="from table1 where tCode=sCode and tCode != 1004"; 
                   //定义一个不相等就行因为 tCode和sCode 是相等的 List list = session.createQuery(hql).list();
return list;
} catch (Exception e) {
throw e;
} finally {
session.close();
}
 LZ去试下 看是不是