Hibernate addscalar method: returns a combination of scalar and entity
•
Java
addScalar(String columnAlias,Type type)
Example
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();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码