简体   繁体   中英

Need to use table alias inside @Formula annotation in Hibernate

Is there a way to reference the current table's alias inside of a @Formula annotation in Hibernate? I want to use the RRN() function which takes in the table name or alias if the table is aliased as a parameter. I tried specifying the table name directly in the annotation but that won't work because the table is aliased.

I also tried {alias} hoping it may be available but it didn't work either.

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

I'm looking to generate a query like this:

select alias.column1, alias.column2, alias.column3, RRN(alias) from table as alias

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM