I don't think that you can call stored procedures with HQL but in your particular case you could use a formula mapping.
<property name="clientName" lazy="true">
(select t.name from your_table t where t.foreign_key=id)
In this particular case the "id" value will be the current object that your are loading id.
posted 6 years ago
Atlast someone answered, I really need to know how to do this.
Thanks for that answer , and I was able to execute one. But I have another question,
That formula mapping is not a global access, it is only particular to a certain table.
What if I have many tables that has a column entityId, so it means that I have to create formula for every table?
I guess that is a tedious work. Is there no way to create a global access or query, (just like if you have stored proc in native sql)
so I won't need to create formula in all of my tables that have entityId.