@@ -82,95 +82,42 @@ public interface JdbcAggregateOperations {
82
82
<T > T update (T instance );
83
83
84
84
/**
85
- * Deletes a single Aggregate including all entities contained in that aggregate.
86
- * <p>
87
- * Since no version attribute is provided this method will never throw a
88
- * {@link org.springframework.dao.OptimisticLockingFailureException}. If no rows match the generated delete operation
89
- * this fact will be silently ignored.
90
- * </p>
85
+ * Counts the number of aggregates of a given type.
91
86
*
92
- * @param id the id of the aggregate root of the aggregate to be deleted. Must not be {@code null}.
93
- * @param domainType the type of the aggregate root.
94
- * @param <T> the type of the aggregate root.
87
+ * @param domainType the type of the aggregates to be counted.
88
+ * @return the number of instances stored in the database. Guaranteed to be not {@code null}.
95
89
*/
96
- < T > void deleteById ( Object id , Class <T > domainType );
90
+ long count ( Class <? > domainType );
97
91
98
92
/**
99
- * Deletes all aggregates identified by their aggregate root ids.
100
- * <p>
101
- * Since no version attribute is provided this method will never throw a
102
- * {@link org.springframework.dao.OptimisticLockingFailureException}. If no rows match the generated delete operation
103
- * this fact will be silently ignored.
104
- * </p>
93
+ * Counts the number of aggregates of a given type that match the given <code>query</code>.
105
94
*
106
- * @param ids the ids of the aggregate roots of the aggregates to be deleted. Must not be {@code null}.
107
- * @param domainType the type of the aggregate root.
108
- * @param <T> the type of the aggregate root.
95
+ * @param query must not be {@literal null}.
96
+ * @param domainType the entity type must not be {@literal null}.
97
+ * @return the number of instances stored in the database. Guaranteed to be not {@code null}.
98
+ * @since 3.0
109
99
*/
110
- <T > void deleteAllById ( Iterable <?> ids , Class <T > domainType );
100
+ <T > long count ( Query query , Class <T > domainType );
111
101
112
102
/**
113
- * Delete an aggregate identified by its aggregate root.
103
+ * Determine whether there are aggregates that match the {@link Query}
114
104
*
115
- * @param aggregateRoot to delete. Must not be {@code null}.
116
- * @param <T> the type of the aggregate root.
105
+ * @param query must not be {@literal null}.
106
+ * @param domainType the entity type must not be {@literal null}.
107
+ * @return {@literal true} if the object exists.
108
+ * @since 3.0
117
109
*/
118
- <T > void delete ( T aggregateRoot );
110
+ <T > boolean exists ( Query query , Class < T > domainType );
119
111
120
112
/**
121
- * Delete an aggregate identified by its aggregate root .
113
+ * Checks if an aggregate identified by type and id exists in the database .
122
114
*
123
- * @param aggregateRoot to delete. Must not be {@code null} .
124
- * @param domainType the type of the aggregate root. Must not be {@code null}.
115
+ * @param id the id of the aggregate root .
116
+ * @param domainType the type of the aggregate root.
125
117
* @param <T> the type of the aggregate root.
126
- * @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and the
127
- * version attribute of the provided entity does not match the version attribute in the database, or when
128
- * there is no aggregate root with matching id. In other cases a NOOP delete is silently ignored.
129
- * @deprecated since 3.0 use {@link #delete(Object)} instead
130
- */
131
- @ Deprecated
132
- default <T > void delete (T aggregateRoot , Class <T > domainType ) {
133
- delete (aggregateRoot );
134
- }
135
-
136
- /**
137
- * Delete all aggregates of a given type.
138
- *
139
- * @param domainType type of the aggregate roots to be deleted. Must not be {@code null}.
140
- */
141
- void deleteAll (Class <?> domainType );
142
-
143
- /**
144
- * Delete all aggregates identified by their aggregate roots.
145
- *
146
- * @param aggregateRoots to delete. Must not be {@code null}.
147
- * @param <T> the type of the aggregate roots.
148
- */
149
- <T > void deleteAll (Iterable <? extends T > aggregateRoots );
150
-
151
- /**
152
- * Delete all aggregates identified by their aggregate roots.
153
- *
154
- * @param aggregateRoots to delete. Must not be {@code null}.
155
- * @param domainType type of the aggregate roots to be deleted. Must not be {@code null}.
156
- * @param <T> the type of the aggregate roots.
157
- * @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and for at least on entity the
158
- * version attribute of the entity does not match the version attribute in the database, or when
159
- * there is no aggregate root with matching id. In other cases a NOOP delete is silently ignored.
160
- * @deprecated since 3.0 use {@link #deleteAll(Iterable)} instead.
161
- */
162
- @ Deprecated
163
- default <T > void deleteAll (Iterable <? extends T > aggregateRoots , Class <T > domainType ) {
164
- deleteAll (aggregateRoots );
165
- }
166
-
167
- /**
168
- * Counts the number of aggregates of a given type.
169
- *
170
- * @param domainType the type of the aggregates to be counted.
171
- * @return the number of instances stored in the database. Guaranteed to be not {@code null}.
118
+ * @return whether the aggregate exists.
172
119
*/
173
- long count ( Class <? > domainType );
120
+ < T > boolean existsById ( Object id , Class <T > domainType );
174
121
175
122
/**
176
123
* Load an aggregate from the database.
@@ -202,16 +149,6 @@ default <T> void deleteAll(Iterable<? extends T> aggregateRoots, Class<T> domain
202
149
*/
203
150
<T > Iterable <T > findAll (Class <T > domainType );
204
151
205
- /**
206
- * Checks if an aggregate identified by type and id exists in the database.
207
- *
208
- * @param id the id of the aggregate root.
209
- * @param domainType the type of the aggregate root.
210
- * @param <T> the type of the aggregate root.
211
- * @return whether the aggregate exists.
212
- */
213
- <T > boolean existsById (Object id , Class <T > domainType );
214
-
215
152
/**
216
153
* Load all aggregates of a given type, sorted.
217
154
*
@@ -238,53 +175,117 @@ default <T> void deleteAll(Iterable<? extends T> aggregateRoots, Class<T> domain
238
175
* Execute a {@code SELECT} query and convert the resulting item to an entity ensuring exactly one result.
239
176
*
240
177
* @param query must not be {@literal null}.
241
- * @param entityClass the entity type must not be {@literal null}.
178
+ * @param domainType the entity type must not be {@literal null}.
242
179
* @return exactly one result or {@link Optional#empty()} if no match found.
243
180
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
244
181
* @since 3.0
245
182
*/
246
- <T > Optional <T > selectOne (Query query , Class <T > entityClass );
183
+ <T > Optional <T > findOne (Query query , Class <T > domainType );
247
184
248
185
/**
249
186
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterable} that is sorted.
250
187
*
251
188
* @param query must not be {@literal null}.
252
- * @param entityClass the entity type must not be {@literal null}.
189
+ * @param domainType the entity type must not be {@literal null}.
253
190
* @return a non-null sorted list with all the matching results.
254
191
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if more than one match found.
255
192
* @since 3.0
256
193
*/
257
- <T > Iterable <T > select (Query query , Class <T > entityClass );
194
+ <T > Iterable <T > findAll (Query query , Class <T > domainType );
258
195
259
196
/**
260
- * Determine whether there are aggregates that match the {@link Query}
197
+ * Returns a {@link Page} of entities matching the given {@link Query}. In case no match could be found, an empty
198
+ * {@link Page} is returned.
261
199
*
262
200
* @param query must not be {@literal null}.
263
- * @param entityClass the entity type must not be {@literal null}.
264
- * @return {@literal true} if the object exists.
201
+ * @param domainType the entity type must not be {@literal null}.
202
+ * @param pageable can be null.
203
+ * @return a {@link Page} of entities matching the given {@link Example}.
265
204
* @since 3.0
266
205
*/
267
- <T > boolean exists (Query query , Class <T > entityClass );
206
+ <T > Page < T > findAll (Query query , Class <T > domainType , Pageable pageable );
268
207
269
208
/**
270
- * Counts the number of aggregates of a given type that match the given <code>query</code>.
209
+ * Deletes a single Aggregate including all entities contained in that aggregate.
210
+ * <p>
211
+ * Since no version attribute is provided this method will never throw a
212
+ * {@link org.springframework.dao.OptimisticLockingFailureException}. If no rows match the generated delete operation
213
+ * this fact will be silently ignored.
214
+ * </p>
271
215
*
272
- * @param query must not be {@literal null}.
273
- * @param entityClass the entity type must not be {@literal null}.
274
- * @return the number of instances stored in the database. Guaranteed to be not {@code null}.
275
- * @since 3.0
216
+ * @param id the id of the aggregate root of the aggregate to be deleted. Must not be {@code null}.
217
+ * @param domainType the type of the aggregate root.
218
+ * @param <T> the type of the aggregate root.
276
219
*/
277
- <T > long count ( Query query , Class <T > entityClass );
220
+ <T > void deleteById ( Object id , Class <T > domainType );
278
221
279
222
/**
280
- * Returns a {@link Page} of entities matching the given {@link Query}. In case no match could be found, an empty
281
- * {@link Page} is returned.
223
+ * Deletes all aggregates identified by their aggregate root ids.
224
+ * <p>
225
+ * Since no version attribute is provided this method will never throw a
226
+ * {@link org.springframework.dao.OptimisticLockingFailureException}. If no rows match the generated delete operation
227
+ * this fact will be silently ignored.
228
+ * </p>
282
229
*
283
- * @param query must not be {@literal null}.
284
- * @param entityClass the entity type must not be {@literal null}.
285
- * @param pageable can be null.
286
- * @return a {@link Page} of entities matching the given {@link Example}.
287
- * @since 3.0
230
+ * @param ids the ids of the aggregate roots of the aggregates to be deleted. Must not be {@code null}.
231
+ * @param domainType the type of the aggregate root.
232
+ * @param <T> the type of the aggregate root.
288
233
*/
289
- <T > Page <T > select (Query query , Class <T > entityClass , Pageable pageable );
234
+ <T > void deleteAllById (Iterable <?> ids , Class <T > domainType );
235
+
236
+ /**
237
+ * Delete an aggregate identified by its aggregate root.
238
+ *
239
+ * @param aggregateRoot to delete. Must not be {@code null}.
240
+ * @param <T> the type of the aggregate root.
241
+ */
242
+ <T > void delete (T aggregateRoot );
243
+
244
+ /**
245
+ * Delete an aggregate identified by its aggregate root.
246
+ *
247
+ * @param aggregateRoot to delete. Must not be {@code null}.
248
+ * @param domainType the type of the aggregate root. Must not be {@code null}.
249
+ * @param <T> the type of the aggregate root.
250
+ * @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and the
251
+ * version attribute of the provided entity does not match the version attribute in the database, or when
252
+ * there is no aggregate root with matching id. In other cases a NOOP delete is silently ignored.
253
+ * @deprecated since 3.0 use {@link #delete(Object)} instead
254
+ */
255
+ @ Deprecated (since = "3.0" )
256
+ default <T > void delete (T aggregateRoot , Class <T > domainType ) {
257
+ delete (aggregateRoot );
258
+ }
259
+
260
+ /**
261
+ * Delete all aggregates of a given type.
262
+ *
263
+ * @param domainType type of the aggregate roots to be deleted. Must not be {@code null}.
264
+ */
265
+ void deleteAll (Class <?> domainType );
266
+
267
+ /**
268
+ * Delete all aggregates identified by their aggregate roots.
269
+ *
270
+ * @param aggregateRoots to delete. Must not be {@code null}.
271
+ * @param <T> the type of the aggregate roots.
272
+ */
273
+ <T > void deleteAll (Iterable <? extends T > aggregateRoots );
274
+
275
+ /**
276
+ * Delete all aggregates identified by their aggregate roots.
277
+ *
278
+ * @param aggregateRoots to delete. Must not be {@code null}.
279
+ * @param domainType type of the aggregate roots to be deleted. Must not be {@code null}.
280
+ * @param <T> the type of the aggregate roots.
281
+ * @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and for
282
+ * at least on entity the version attribute of the entity does not match the version attribute in the
283
+ * database, or when there is no aggregate root with matching id. In other cases a NOOP delete is silently
284
+ * ignored.
285
+ * @deprecated since 3.0 use {@link #deleteAll(Iterable)} instead.
286
+ */
287
+ @ Deprecated (since = "3.0" )
288
+ default <T > void deleteAll (Iterable <? extends T > aggregateRoots , Class <T > domainType ) {
289
+ deleteAll (aggregateRoots );
290
+ }
290
291
}
0 commit comments