Skip to content

Comments

Add enterprise pattern: JDBC versus jOOQ#67

Merged
brunoborges merged 2 commits intomainfrom
copilot/add-new-slug-jdbc-vs-jooq
Feb 20, 2026
Merged

Add enterprise pattern: JDBC versus jOOQ#67
brunoborges merged 2 commits intomainfrom
copilot/add-new-slug-jdbc-vs-jooq

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Adds a new enterprise pattern comparing raw JDBC to jOOQ's type-safe SQL DSL.

New pattern: enterprise/jdbc-vs-jooq (id=112)

Field Value
Difficulty intermediate
Old approach Raw JDBC (PreparedStatement + manual ResultSet mapping)
Modern approach jOOQ DSLContext with generated table/column constants

Old (Raw JDBC):

String sql = "SELECT id, name, email FROM users "
           + "WHERE department = ? AND salary > ?";
try (Connection con = ds.getConnection();
     PreparedStatement ps = con.prepareStatement(sql)) {
    ps.setString(1, department);
    ps.setBigDecimal(2, minSalary);
    ResultSet rs = ps.executeQuery();
    List<User> result = new ArrayList<>();
    while (rs.next()) {
        result.add(new User(
            rs.getLong("id"),
            rs.getString("name"),
            rs.getString("email")));
    }
    return result;
}

Modern (jOOQ):

return dsl
    .select(USERS.ID, USERS.NAME, USERS.EMAIL)
    .from(USERS)
    .where(USERS.DEPARTMENT.eq(department)
        .and(USERS.SALARY.gt(minSalary)))
    .fetchInto(User.class);

Why modern wins

  • Type-safe columns — generated Java constants catch typos/type mismatches at compile time
  • SQL fluency — DSL mirrors SQL syntax; JOINs, subqueries, CTEs stay readable
  • Injection-free by design — no string concatenation; parameters always bound safely

Navigation chain

Appended at the end of the enterprise chain: spring-xml-config-vs-annotations → jdbc-vs-jooq (previously spring-xml-config-vs-annotations.next was null).

Original prompt

This section details on the original issue you should resolve

<issue_title>New slug: JDBC versus jOOQ</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add new slug for JDBC versus jOOQ Add enterprise pattern: JDBC versus jOOQ Feb 20, 2026
Copilot AI requested a review from brunoborges February 20, 2026 08:19
@brunoborges brunoborges marked this pull request as ready for review February 20, 2026 08:21
@brunoborges brunoborges merged commit 3bbca40 into main Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New slug: JDBC versus jOOQ

2 participants