Could someone please guide me on how to use alias in jOOQ. I tried looking into jOOQ documentation but it is not clear. Please provide an example if possible.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Both org.jooq.Table
and org.jooq.Field
types implement org.jooq.AliasProvider
. This means, that you can call as(String)
on them, to create an aliased object. Example:
Table<?> aliasedTable = MY_TABLE.as("t"); Field<?> aliasedField = MY_FIELD.as("f");
The examples from the jOOQ manual include:
TBook book = T_BOOK.as("b"); TAuthor author = T_AUTHOR.as("a"); create.select(author.ID, book.ID) .from(author) .join(book).on(author.ID.equal(book.AUTHOR_ID))
文章来源: How to use alias in jOOQ