Hello everyone, there is currently a need to find the sum of two columns in the table, and then sort the results. The detailed description is as follows:
There are two columns in my table: fee a (pay_a) and fee b (pay_b). The current requirement is to add the two and sum them (select (pay_a pay_b) from paytable), Then the results are sorted (the database uses oracle).
The framework I use is spring data jpa. When using sort, I found that sort cannot parse the addition expression. There is no such member in the prompt table.
Change the method, use @Transient to declare a new member payall in the entity (there is no such column in the database table), and define getPayall()
{
return pay_a + pay_b;
}
Then in sort, use "payall" to sort, and the result is an error.
Unable to locate Attribute with the given name [payall] on this ManagedType [io.koala.tobacco. dataservice.entity.PotentialCust]
I don’t know how to deal with it now. Please help all the experts! Thank you!
nativeQuery = true Use native sql to query