setParameter(String name,Object val)
String hql = "from UserForm where username=:userName"; //定義查詢HQL語句 Query query = session.createQuery(hql); //執行查詢語句獲取Query物件 query.setParameter("userName","wgh"); //設定HQL語句引數 list = query.list();