i have an entity like this:
public class Account{
private String code;
@ManyToOne
private Account ledgerAccount;
public String getCode(){
return code;
}
public String getFullCode(){
return ledgerAccount.getCode()+code;
}
}
So, fullCode is a derived property, i want to use it in my hql queries, how can i achive this?
Create a property called
fullCodein your model and annotate it like this:and change your
getFullCode()method to:And then in your HQL:
If you haven’t already, check this page for more examples.