Skip to content

Commit 24a6f2a

Browse files
committed
improve javadoc for first/max results and rename a parameter
1 parent 54e160a commit 24a6f2a

File tree

10 files changed

+32
-23
lines changed

10 files changed

+32
-23
lines changed

hibernate-core/src/main/java/org/hibernate/query/NativeQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ interface FetchReturn extends ResultNode {
624624
NativeQuery<T> addQueryHint(String hint);
625625

626626
@Override
627-
NativeQuery<T> setMaxResults(int maxResult);
627+
NativeQuery<T> setMaxResults(int maxResults);
628628

629629
@Override
630630
NativeQuery<T> setFirstResult(int startPosition);

hibernate-core/src/main/java/org/hibernate/query/Query.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ default Query<R> applyLoadGraph(@SuppressWarnings("rawtypes") RootGraph graph) {
897897
// covariant overrides - jakarta.persistence.Query/TypedQuery
898898

899899
@Override
900-
Query<R> setMaxResults(int maxResult);
900+
Query<R> setMaxResults(int maxResults);
901901

902902
@Override
903903
Query<R> setFirstResult(int startPosition);

hibernate-core/src/main/java/org/hibernate/query/SelectionQuery.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,25 +416,34 @@ default Stream<R> stream() {
416416
SelectionQuery<R> setReadOnly(boolean readOnly);
417417

418418
/**
419-
* The max number of rows requested for the query results
419+
* The maximum number of query result rows to return.
420+
*
421+
* @return the maximum length of the query result list
420422
*/
421423
int getMaxResults();
422424

423425
/**
424-
* Set the max number of rows requested for the query results. Applied
425-
* to the SQL query
426+
* Set the maximum number of query result rows to return.
427+
*
428+
* @param maxResults the maximum length of the query result list
426429
*/
427-
SelectionQuery<R> setMaxResults(int maxResult);
430+
SelectionQuery<R> setMaxResults(int maxResults);
428431

429432
/**
430-
* The first row position to return from the query results. Applied
431-
* to the SQL query.
433+
* The first query result row to return. The very first row
434+
* of the query result list is considered the zeroth row.
435+
*
436+
* @return the position of the first row to return,
437+
* indexed from zero
432438
*/
433439
int getFirstResult();
434440

435441
/**
436-
* Set the first row position to return from the query results. Applied
437-
* to the SQL query.
442+
* Set the first query result row to return. The very first
443+
* row of the query result list is considered the zeroth row.
444+
*
445+
* @param startPosition the position of the first row to return,
446+
* indexed from zero
438447
*/
439448
SelectionQuery<R> setFirstResult(int startPosition);
440449

hibernate-core/src/main/java/org/hibernate/query/hql/spi/SqmQueryImplementor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ default <T> SqmQueryImplementor<T> setResultTransformer(ResultTransformer<T> tra
110110
SqmQueryImplementor<R> setQueryFlushMode(QueryFlushMode queryFlushMode);
111111

112112
@Override
113-
SqmQueryImplementor<R> setMaxResults(int maxResult);
113+
SqmQueryImplementor<R> setMaxResults(int maxResults);
114114

115115
@Override
116116
SqmQueryImplementor<R> setFirstResult(int startPosition);

hibernate-core/src/main/java/org/hibernate/query/spi/AbstractQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public int getMaxResults() {
158158
}
159159

160160
@Override
161-
public QueryImplementor<R> setMaxResults(int maxResult) {
162-
super.setMaxResults( maxResult );
161+
public QueryImplementor<R> setMaxResults(int maxResults) {
162+
super.setMaxResults( maxResults );
163163
return this;
164164
}
165165

hibernate-core/src/main/java/org/hibernate/query/spi/AbstractSelectionQuery.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ public SelectionQuery<R> setFlushMode(FlushModeType flushMode) {
350350
}
351351

352352
@Override
353-
public SelectionQuery<R> setMaxResults(int maxResult) {
354-
if ( maxResult < 0 ) {
353+
public SelectionQuery<R> setMaxResults(int maxResults) {
354+
if ( maxResults < 0 ) {
355355
throw new IllegalArgumentException( "Max results cannot be negative" );
356356
}
357357
getSession().checkOpen();
358-
getQueryOptions().getLimit().setMaxRows(maxResult);
358+
getQueryOptions().getLimit().setMaxRows( maxResults );
359359
return this;
360360
}
361361

hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,8 +1642,8 @@ public <S> NativeQueryImplementor<S> setResultTransformer(ResultTransformer<S> t
16421642
}
16431643

16441644
@Override
1645-
public NativeQueryImplementor<R> setMaxResults(int maxResult) {
1646-
super.setMaxResults( maxResult );
1645+
public NativeQueryImplementor<R> setMaxResults(int maxResults) {
1646+
super.setMaxResults( maxResults );
16471647
return this;
16481648
}
16491649

hibernate-core/src/main/java/org/hibernate/query/sql/spi/NativeQueryImplementor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ NativeQueryImplementor<R> addJoin(
190190
NativeQueryImplementor<R> setComment(String comment);
191191

192192
@Override
193-
NativeQueryImplementor<R> setMaxResults(int maxResult);
193+
NativeQueryImplementor<R> setMaxResults(int maxResults);
194194

195195
@Override
196196
NativeQueryImplementor<R> setFirstResult(int startPosition);

hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ public SqmQueryImplementor<R> setResultListTransformer(ResultListTransformer<R>
700700
}
701701

702702
@Override
703-
public SqmQueryImplementor<R> setMaxResults(int maxResult) {
704-
super.setMaxResults( maxResult );
703+
public SqmQueryImplementor<R> setMaxResults(int maxResults) {
704+
super.setMaxResults( maxResults );
705705
return this;
706706
}
707707

hibernate-core/src/main/java/org/hibernate/query/sqm/spi/DelegatingSqmSelectionQueryImplementor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ public int getMaxResults() {
190190
}
191191

192192
@Override
193-
public SqmSelectionQueryImplementor<R> setMaxResults(int maxResult) {
194-
getDelegate().setMaxResults( maxResult );
193+
public SqmSelectionQueryImplementor<R> setMaxResults(int maxResults) {
194+
getDelegate().setMaxResults( maxResults );
195195
return this;
196196
}
197197

0 commit comments

Comments
 (0)