Skip to content

Try out Flyway + jOOQ #11

Description

@KPull

Description

Let's try out Flyway/jOOQ! We write a simple application which automatically brings its associated database up to date. Then we execute queries to the database using jOOQ using code generated from the framework itself.

Some background:

  • Flyway: Flyway allows applications to manage the schema version of a database. This is important because just like we have version control for code, the same concepts and principles should apply to database schemas. An application can automatically determine whether a database schema needs to be updated and apply any missing schema version automatically.
  • jOOQ: Hibernate is a well-known (massive) leaky abstraction because it tries to force the relational model into an awkward OOP model. An alternative is to write DAOs where a developer writes SQL for all the queries they need in an application (and hence we regain control of the data layer). Unfortunately, this is error prone and not portable across different database vendors. jOOQ allows developers to write type-checked "SQL" in a portable fashion.

Outcome

  • Set up a database using Flyway and schema migrations.
  • Generate jOOQ schema code from the database.
  • Execute queries on the database using jOOQ.

For office use only

  • If you would like to do this exercise add a 👍 reaction to this comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions