This is declaring that you want the result of the query to return objects for individual named columns, rather than entities. For instance
createSQLQuery("SELECT COUNT(*) AS c FROM Users").addScalar("c").uniqueResult()
Will return a single Long
. If you specify multiple scalars, the result will come back as an array of Object
. Its similar to executeScalar
except that it works on named columns, and can return a composite result.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…