Reputation: 2432
In our Java project we have started to use jooq for query building instead of plain SQL strings. The library is awesome, but I have a question (since I am jooq-newbie): Is it possible to create database using jooq, but WITHOUT PROJECT INCLUDED jooq mapping/generator?
Upvotes: 2
Views: 2002
Reputation: 220952
There is a lot that you can do with jOOQ without relying on its code generator. The getting started guide from the manual mentions some examples:
http://www.jooq.org/doc/2.6/manual/getting-started/use-cases/jooq-as-a-standalone-sql-builder/
For instance:
String sql = create.select(
fieldByName("BOOK","TITLE"),
fieldByName("AUTHOR","FIRST_NAME"),
fieldByName("AUTHOR","LAST_NAME"))
.from(tableByName("BOOK"))
.join(tableByName("AUTHOR"))
.on(fieldByName("BOOK", "AUTHOR_ID").equal("AUTHOR", "ID"))
.where(fieldByName("BOOK", "PUBLISHED_IN").equal(1948))
.getSQL();
It also references to the manual's section about using jOOQ for "plain SQL":
http://www.jooq.org/doc/2.6/manual/sql-building/plain-sql/
Of course, you can still use the code generator to generate meta information for your schema. This doesn't mean that you will have to add a runtime dependency on the generator, as the generator is only used at compile-time
Upvotes: 2