@@ -195,13 +195,13 @@ public void delete(T entity) {
195
195
return ;
196
196
}
197
197
198
- Class <?> type = ProxyUtils .getUserClass (entity );
199
-
200
198
if (entityManager .contains (entity )) {
201
199
entityManager .remove (entity );
202
200
return ;
203
201
}
204
202
203
+ Class <?> type = ProxyUtils .getUserClass (entity );
204
+
205
205
// if the entity to be deleted doesn't exist, delete is a NOOP
206
206
T existing = (T ) entityManager .find (type , entityInformation .getId (entity ));
207
207
if (existing != null ) {
@@ -282,8 +282,7 @@ public void deleteAllInBatch(Iterable<T> entities) {
282
282
return ;
283
283
}
284
284
285
- applyAndBind (getQueryString (DELETE_ALL_QUERY_STRING , entityInformation .getEntityName ()), entities ,
286
- entityManager )
285
+ applyAndBind (getQueryString (DELETE_ALL_QUERY_STRING , entityInformation .getEntityName ()), entities , entityManager )
287
286
.executeUpdate ();
288
287
}
289
288
@@ -321,7 +320,8 @@ public Optional<T> findById(ID id) {
321
320
LockModeType type = metadata .getLockModeType ();
322
321
Map <String , Object > hints = getHints ();
323
322
324
- return Optional .ofNullable (type == null ? entityManager .find (domainType , id , hints ) : entityManager .find (domainType , id , type , hints ));
323
+ return Optional .ofNullable (
324
+ type == null ? entityManager .find (domainType , id , hints ) : entityManager .find (domainType , id , type , hints ));
325
325
}
326
326
327
327
@ Deprecated
@@ -481,7 +481,8 @@ public long delete(@Nullable Specification<T> spec) {
481
481
CriteriaDelete <T > delete = builder .createCriteriaDelete (getDomainClass ());
482
482
483
483
if (spec != null ) {
484
- Predicate predicate = spec .toPredicate (delete .from (getDomainClass ()), builder .createQuery (getDomainClass ()), builder );
484
+ Predicate predicate = spec .toPredicate (delete .from (getDomainClass ()), builder .createQuery (getDomainClass ()),
485
+ builder );
485
486
486
487
if (predicate != null ) {
487
488
delete .where (predicate );
@@ -519,7 +520,7 @@ private <S extends T, R> R doFindBy(Specification<T> spec, Class<T> domainClass,
519
520
TypedQuery <T > query = getQuery (specToUse , domainClass , sort );
520
521
521
522
if (scrollPosition instanceof OffsetScrollPosition offset ) {
522
- if (!offset .isInitial ()) {
523
+ if (!offset .isInitial ()) {
523
524
query .setFirstResult (Math .toIntExact (offset .getOffset ()) + 1 );
524
525
}
525
526
}
@@ -531,8 +532,8 @@ private <S extends T, R> R doFindBy(Specification<T> spec, Class<T> domainClass,
531
532
532
533
SpecificationScrollDelegate <T > scrollDelegate = new SpecificationScrollDelegate <>(scrollFunction ,
533
534
entityInformation );
534
- FetchableFluentQueryBySpecification <?, T > fluentQuery = new FetchableFluentQueryBySpecification <>(spec , domainClass , finder ,
535
- scrollDelegate , this ::count , this ::exists , this .entityManager , getProjectionFactory ());
535
+ FetchableFluentQueryBySpecification <?, T > fluentQuery = new FetchableFluentQueryBySpecification <>(spec , domainClass ,
536
+ finder , scrollDelegate , this ::count , this ::exists , this .entityManager , getProjectionFactory ());
536
537
537
538
return queryFunction .apply ((FetchableFluentQuery <S >) fluentQuery );
538
539
}
0 commit comments