addScalar(String columnAlias,Type type)
引數說明:String sql = "select avg(result.english)as avgEnglish from tb_result result"; //定義查詢SQL語句 SQLQuery query = session.createSQLQuery(sql) //執行查詢語句 .addScalar("avgEnglish",Hibernate.FLOAT); Float avgEnglish = (Float)query.uniqueResult();