Integration of Jooq SQL builder with Bootique. See usage example bootique-jooq-demo.
Include bootique-jooq
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.bootique.bom</groupId>
<artifactId>bootique-bom</artifactId>
<version>3.0-M6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
<dependency>
<groupId>io.bootique.jooq</groupId>
<artifactId>bootique-jooq</artifactId>
</dependency>
Do whatever Jooq class generation is required (for now outside of bootique-jooq scope).
Create configuration with DB connection information and optional Jooq settings:
jdbc:
default:
url: "jdbc:postgresql://192.168.99.100:5432/scheduling"
initialSize: 1
username: postgres
password: postgres
jooq:
dialect: POSTGRES
executeLogging: true
Inject JooqFactory
and start using Jooq:
@Inject
private JooqFactory jooqFactory;
public void doSomething() {
try (DSLContext c = jooqFactory.newContext()) {
Record r = c.select().from(Tables.MY_TABLE).fetchOne();
}
}