Q:

What is the Hibernate Equivalent of this query?(Adding Two Columns)

This is the query 
SELECT id, name, sub1, sub2, sub1 + sub2 AS total 
FROM mytable 
ORDER BY sub1 + sub2 ASC

What I am trying to do here is that I will add sub1 and sub2 and the result would be named TOTAL, and I will use TOTAL for Order By.  so far this is how I've come up with but it is not rendering proper reults
sess().createSQLQuery("SELECT *, SUB1+ SUB2 AS TOTAL FROM TRACKS order by TOTAL ").addEntity(Student.class).list();

What is the hibernate or Query Criteria equivalent of what I am trying to do? 

A:

there is no such operation in JPQL, But what you could do is do a native query as follows:
"SELECT * FROM TRACKS order by SUB1+ SUB2"

And make a getter like:
public Double getTotal(){ //Replace Double for the data type you use
    return sub1 + sub2;
}

That way you could order the query as you want. 
Is this what you're trying to do?  I'm not sure if I understood quite well your question

