I would like to order a query by a function which uses properties of the class. Something like:
@entity
class A
{
private int id;
private String name;
public int StringLength()
{
return name.length();
}
}
And the sentence something like: select n from A order by name.StringLength()
. Is it possible?
No you can't, but if you want to query based on the length of one of the property you can use the length function similar to SQL:
select n from A order by length(name)