Skip to content

Commit c20dff6

Browse files
authored
Merge pull request #1428 from njr-11/null-sorting-on-OrderBy-anno
OrderBy annotation can indicate sorting of nulls
2 parents 653455f + fd25d7f commit c20dff6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

api/src/main/java/jakarta/data/repository/OrderBy.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import jakarta.data.Order;
2121
import jakarta.data.Sort;
22+
import jakarta.data.Sort.Nulls;
2223

2324
import java.lang.annotation.ElementType;
2425
import java.lang.annotation.Repeatable;
@@ -113,6 +114,21 @@
113114
*/
114115
boolean ignoreCase() default false;
115116

117+
/**
118+
* <p>Indicates whether {@code null} values are ordered
119+
* {@link Nulls#FIRST FIRST}, {@link Nulls#LAST LAST}, or
120+
* {@linkplain Nulls#UNSPECIFIED by the data store}.</p>
121+
*
122+
* <p>If the data store is a non-relational database that is not
123+
* capable of ordering {@code null} values, then repository methods
124+
* annotated to order nulls {@code FIRST} or {@code LAST} must raise
125+
* {@link UnsupportedOperationException}.</p>
126+
*
127+
* @return indication of how {@code null} values are ordered.
128+
* @since 1.1
129+
*/
130+
Nulls nullOrdering() default Nulls.UNSPECIFIED;
131+
116132
/**
117133
* <p>Entity attribute name to sort by.</p>
118134
*

0 commit comments

Comments
 (0)