You must use the table alias inside the @Formula annotation in Hibernate

Is there a way to reference the current table alias inside the @Formula annotation in Hibernate? I want to use the RRN () function, which takes a table name or an alias if the table aliases as a parameter. I tried to specify the table name directly in the annotation, but this will not work because the table is smoothed.

I also tried {alias} in the hope that it will be available, but it does not work either.

@Formula("RRN({alias})")

I want to create a query like this:

select alias.column1, alias.column2, alias.column3, RRN(alias) from table as alias
+4
source share

Source: https://habr.com/ru/post/1654399/


All Articles