|The jOOQ User Manual. Multiple Pages : Getting started with jOOQ : Tutorials : jOOQ in 7 easy steps : Step 5: Querying||previous : next|
Let's add a simple query:
Factory create = new Factory(conn, SQLDialect.MYSQL); Result<Record> result = create.select().from(POSTS).fetch();
First get an instance of
Factory so we can write a simple
SELECT query. We pass an instance of the MySQL connection to
Factory. Note that the factory doesn't close the connection. We'll have to do that ourselves.
We then use jOOQ's DSL to return an instance of Result. We'll be using this result in the next step.