Skip to content

Instantly share code, notes, and snippets.

@xcv58
Created August 19, 2016 18:55
Show Gist options
  • Select an option

  • Save xcv58/55a02a4cb2c0730b5c613badf0467d1f to your computer and use it in GitHub Desktop.

Select an option

Save xcv58/55a02a4cb2c0730b5c613badf0467d1f to your computer and use it in GitHub Desktop.
// Fetch a SQL string from a jOOQ Query in order to manually execute it with another tool.
// For simplicity reasons, we're using the API to construct case-insensitive object references, here.
String sql = create.select(field("BOOK.TITLE"), field("AUTHOR.FIRST_NAME"), field("AUTHOR.LAST_NAME"))
.from(table("BOOK"))
.join(table("AUTHOR"))
.on(field("BOOK.AUTHOR_ID").equal(field("AUTHOR.ID")))
.where(field("BOOK.PUBLISHED_IN").equal(1948))
.getSQL();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment