Skip to content

Releases: EzFramework/JavaQueryBuilder

1.0.4

18 Apr 12:44
f30e892

Choose a tag to compare

Added

Subquery support (feature/subquery — PR #21)

  • New JoinClause model class representing a JOIN entry targeting either a plain table or a derived-table subquery (INNER / LEFT / RIGHT / CROSS).
  • New ScalarSelectItem model class representing a (SELECT ...) AS alias item in the SELECT clause.
  • Query extended with four new fields: fromSubquery, fromAlias, joins, selectSubqueries.
  • QueryBuilder new fluent methods:
    • whereInSubquery(String column, Query subquery)WHERE col IN (SELECT ...)
    • whereEqualsSubquery(String column, Query subquery)WHERE col = (SELECT ...)
    • whereExistsSubquery(Query subquery)WHERE EXISTS (SELECT ...)
    • whereNotExistsSubquery(Query subquery)WHERE NOT EXISTS (SELECT ...)
    • fromSubquery(Query subquery, String alias)FROM (SELECT ...) AS alias
    • joinSubquery(Query subquery, String alias, String onCondition)INNER JOIN (SELECT ...) AS alias ON ...
    • selectSubquery(Query subquery, String alias) — appends (SELECT ...) AS alias to the SELECT list
  • DeleteBuilder new fluent methods:
    • whereInSubquery(String column, Query subquery)DELETE WHERE col IN (SELECT ...)
    • whereExistsSubquery(Query subquery)DELETE WHERE EXISTS (SELECT ...)
  • Operator enum: added EXISTS_SUBQUERY and NOT_EXISTS_SUBQUERY values.
  • Deterministic subquery parameter ordering contract in AbstractSqlDialect.render(): scalar SELECT subquery params → FROM subquery params → JOIN subquery params → WHERE condition params.
  • New test classes: SubqueryConditionTest, ExistsSubqueryTest, FromSubqueryTest, JoinSubqueryTest, ScalarSelectSubqueryTest, NestedSubqueryParamOrderTest, DeleteSubqueryIntegrationTest.
  • SqlExecutionMatrixTest — real SQLite integration tests covering all builder operations across standard, MySQL, and SQLite dialects.
  • Test dependencies added: junit-jupiter-params 6.0.3, sqlite-jdbc 3.46.1.3 (test scope).

Dialect-aware DELETE rendering (feature/delete-from — PR #20)

  • SqlDialect interface: new renderDelete(Query query) method.
  • AbstractSqlDialect.renderDelete(Query) — standard implementation rendering DELETE FROM <table> WHERE ... with full parameter binding via the shared appendWhereClause helper.
  • AbstractSqlDialect.supportsDeleteLimit() — protected hook; default false. Override to enable dialect-specific DELETE ... LIMIT.
  • MySqlDialect: overrides supportsDeleteLimit()true.
  • SqliteDialect: overrides supportsDeleteLimit()true.
  • AbstractSqlDialectDeleteTest — new test class covering DELETE rendering, dialect quoting, LIMIT behaviour, and IN-clause placeholder count.

Changed

  • DeleteBuilder.build(SqlDialect) refactored: removed inline SQL string building; now delegates entirely to SqlDialect.renderDelete(Query).
  • AbstractSqlDialect.appendWhereClause() and appendConditionFragment() promoted from private to protected to allow reuse in renderDelete.
  • Condition.matches() updated: guards IN and NOT_IN operators against subquery values (returns false when value is a Query instance, since subqueries cannot be evaluated in-memory).
  • CI: replaced JaCoCo PR-comment reporter (madrapps/jacoco-report) with codecov/codecov-action@v5.

Documentation

  • README updated with subquery usage examples (scalar SELECT, FROM derived table, JOIN subquery, WHERE IN subquery, WHERE EXISTS).
  • README updated with renderDelete documentation and DELETE LIMIT dialect behaviour.
  • README artifact ID corrected.
  • Version bumped to 1.0.4 in pom.xml.

1.0.3

16 Apr 09:24
2d9419c

Choose a tag to compare

Added

  • SelectBuilder: fluent builder for SQL SELECT statements with support for
    columns, WHERE conditions, ORDER BY, GROUP BY, HAVING, LIMIT, OFFSET, and DISTINCT
  • CreateBuilder: fluent builder for SQL CREATE TABLE statements with support for
    columns, primary keys, and IF NOT EXISTS
  • QueryBuilder: unified static entry point for all builder types
    • select(), from() for SELECT queries
    • insert(), insertInto(table) for INSERT queries
    • update(), update(table) for UPDATE queries
    • delete(), deleteFrom(table) for DELETE queries
    • createTable(), createTable(table) for CREATE TABLE queries
  • Table-shortcut overloads on QueryBuilder: insertInto, deleteFrom, update(table),
    and createTable(table) to set the target table in a single call
  • whereIn support on DeleteBuilder

Fixed

  • DeleteBuilder: restored missing build() and build(SqlDialect) methods whose
    Javadoc was malformed and consumed the method body
  • DeleteBuilder: added missing imports (Connector, Operator, SqlDialect, SqlResult, Map)
  • DeleteBuilder: added appendDmlCondition helper to handle all comparison operators
    and resolve cyclomatic complexity violation; fixed duplicate /** on handleBetweenOperator
  • CreateBuilder: repaired malformed class-level Javadoc that contained an embedded
    method body, and fixed unclosed build(SqlDialect) Javadoc comment
  • QueryBuilder: removed redundant same-package imports, fixed import ordering,
    added complete Javadoc on all public API methods

1.0.2

15 Apr 15:49
923eed9

Choose a tag to compare

  • Fixed issue in Jitpack publish CI

1.0.1

15 Apr 15:45
d9cab48

Choose a tag to compare

Java 25

Updated the package to Java 25

1.0.0

15 Apr 14:39
8bba049

Choose a tag to compare

Highlights

  • Fluent, type-safe builder API for constructing SQL SELECT queries in Java
  • Parameterized SQL generation: All queries use ? placeholders and separate parameter lists, ensuring safety from SQL injection
  • Comprehensive operator support: =, !=, >, <, LIKE, IN, BETWEEN, IS NOT NULL, and more
  • Column selection, grouping, sorting, and pagination: Easily specify columns, GROUP BY, ORDER BY, LIMIT, and OFFSET
  • Multiple SQL dialects: Built-in support for Standard SQL and SQLite, with automatic identifier quoting and boolean handling
  • In-memory filtering: Use the same query objects to filter Java collections via the QueryableStorage interface
  • No runtime dependencies: Pure Java 21 library

Example Usage

SqlResult result = new QueryBuilder()
    .select("id", "name")
    .whereEquals("status", "active")
    .orderBy("name", true)
    .limit(10)
    .buildSql("users");

Architecture

  • Fluent builders for SELECT, INSERT, UPDATE, DELETE
  • Immutable Query objects
  • Pluggable SQL dialects
  • Full Javadoc and Checkstyle compliance