diff --git a/ebean-api/src/main/java/io/ebean/QueryBuilder.java b/ebean-api/src/main/java/io/ebean/QueryBuilder.java index 3c6fea93d0..0b863f9812 100644 --- a/ebean-api/src/main/java/io/ebean/QueryBuilder.java +++ b/ebean-api/src/main/java/io/ebean/QueryBuilder.java @@ -20,7 +20,7 @@ * @param The type of the builder * @param The entity bean type */ -public interface QueryBuilder extends QueryBuilderProjection { +public interface QueryBuilder, T> extends QueryBuilderProjection { /** * Set root table alias. diff --git a/ebean-api/src/main/java/io/ebean/QueryBuilderProjection.java b/ebean-api/src/main/java/io/ebean/QueryBuilderProjection.java index 54ff946571..8acc9a9f30 100644 --- a/ebean-api/src/main/java/io/ebean/QueryBuilderProjection.java +++ b/ebean-api/src/main/java/io/ebean/QueryBuilderProjection.java @@ -6,7 +6,7 @@ * @param The builder type * @param The entity bean type */ -public interface QueryBuilderProjection { +public interface QueryBuilderProjection, T> { /** * Apply the path properties replacing the select and fetch clauses. diff --git a/ebean-api/src/main/resources/META-INF/ebean-version.mf b/ebean-api/src/main/resources/META-INF/ebean-version.mf index 93878300f6..a0b3146360 100644 --- a/ebean-api/src/main/resources/META-INF/ebean-version.mf +++ b/ebean-api/src/main/resources/META-INF/ebean-version.mf @@ -1 +1 @@ -ebean-version: 145 +ebean-version: 148 diff --git a/ebean-net-postgis-types/pom.xml b/ebean-net-postgis-types/pom.xml index 4a2a88dd23..897102eb02 100644 --- a/ebean-net-postgis-types/pom.xml +++ b/ebean-net-postgis-types/pom.xml @@ -78,7 +78,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1 diff --git a/ebean-postgis-types/pom.xml b/ebean-postgis-types/pom.xml index 75bf3272ca..675952606d 100644 --- a/ebean-postgis-types/pom.xml +++ b/ebean-postgis-types/pom.xml @@ -86,7 +86,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1 diff --git a/ebean-querybean/pom.xml b/ebean-querybean/pom.xml index 597242ca15..bd061d5976 100644 --- a/ebean-querybean/pom.xml +++ b/ebean-querybean/pom.xml @@ -96,7 +96,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1 diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/IQueryBean.java b/ebean-querybean/src/main/java/io/ebean/typequery/IQueryBean.java index 3fff7c44bf..0d2fcb0a69 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/IQueryBean.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/IQueryBean.java @@ -44,7 +44,7 @@ * @param the entity bean type (normal entity bean type e.g. Customer) * @param the specific query bean type (e.g. QCustomer) */ -public interface IQueryBean extends QueryBuilder { +public interface IQueryBean> extends QueryBuilder { /** * Return the underlying query. @@ -64,6 +64,7 @@ public interface IQueryBean extends QueryBuilder { * * @param properties The properties to include in the DISTINCT ON clause. */ + @SuppressWarnings("unchecked") R distinctOn(TQProperty... properties); /** diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/QueryBean.java b/ebean-querybean/src/main/java/io/ebean/typequery/QueryBean.java index 9dd782347d..44fbabf306 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/QueryBean.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/QueryBean.java @@ -57,7 +57,7 @@ * @param the specific root query bean type (e.g. QCustomer) */ @NullMarked -public abstract class QueryBean implements IQueryBean { +public abstract class QueryBean> implements IQueryBean { /** * The underlying query. diff --git a/ebean-querybean/src/test/java/org/querytest/QueryAlsoIfTest.java b/ebean-querybean/src/test/java/org/querytest/QueryAlsoIfTest.java index bf992859b0..33702725b1 100644 --- a/ebean-querybean/src/test/java/org/querytest/QueryAlsoIfTest.java +++ b/ebean-querybean/src/test/java/org/querytest/QueryAlsoIfTest.java @@ -1,5 +1,9 @@ package org.querytest; +import io.ebean.QueryBuilder; +import io.ebean.QueryBuilderProjection; +import io.ebean.typequery.IQueryBean; +import io.ebean.typequery.QueryBean; import org.example.domain.Customer; import org.example.domain.query.QCustomer; import org.junit.jupiter.api.Test; @@ -46,4 +50,29 @@ void notApply() { q.findList(); assertThat(q.getGeneratedSql()).isEqualTo("select /* QueryAlsoIfTest.notApply */ t0.id, t0.name from be_customer t0 where t0.name is not null"); } + + @Test + void queryBuilders_expect_fluidUseOfSELF() { + var q = new QCustomer(); + checkQueryBean(q); + checkIQueryBean(q); + checkQueryBuilder(q); + checkQueryBuilderProjection(q); + } + + private void checkQueryBean(QueryBean queryBean) { + queryBean.setFirstRow(10).setMaxRows(10); + } + + private void checkIQueryBean(IQueryBean iQueryBean) { + iQueryBean.setFirstRow(10).setMaxRows(20); + } + + private void checkQueryBuilderProjection(QueryBuilderProjection queryBuilder) { + queryBuilder.fetch("a").fetch("b"); + } + + private void checkQueryBuilder(QueryBuilder queryBuilder) { + queryBuilder.setFirstRow(10).setMaxRows(10); + } } diff --git a/ebean-redis/pom.xml b/ebean-redis/pom.xml index 628b8f8b31..2ebf287546 100644 --- a/ebean-redis/pom.xml +++ b/ebean-redis/pom.xml @@ -72,7 +72,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1 diff --git a/ebean-spring-txn/pom.xml b/ebean-spring-txn/pom.xml index cddf766863..2b2bd13ca4 100644 --- a/ebean-spring-txn/pom.xml +++ b/ebean-spring-txn/pom.xml @@ -99,7 +99,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1 diff --git a/ebean-test/pom.xml b/ebean-test/pom.xml index 6eebab4017..3450656c52 100644 --- a/ebean-test/pom.xml +++ b/ebean-test/pom.xml @@ -309,7 +309,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1 diff --git a/pom.xml b/pom.xml index 52ed20f71f..2e07fb472d 100644 --- a/pom.xml +++ b/pom.xml @@ -53,8 +53,8 @@ 14.2.0 7.4 9.0 - 14.7.0 - 14.7.0 + 14.7.1 + 14.7.1 false diff --git a/tests/test-java16/pom.xml b/tests/test-java16/pom.xml index 19d8bba361..379c912214 100644 --- a/tests/test-java16/pom.xml +++ b/tests/test-java16/pom.xml @@ -52,7 +52,7 @@ true - io.ebean.tile:enhancement:14.6.0 + io.ebean.tile:enhancement:14.7.1