@@ -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
@@ -486,7 +486,8 @@ public long delete(@Nullable Specification<T> spec) {
486
486
CriteriaDelete <T > delete = builder .createCriteriaDelete (getDomainClass ());
487
487
488
488
if (spec != null ) {
489
- Predicate predicate = spec .toPredicate (delete .from (getDomainClass ()), builder .createQuery (getDomainClass ()), builder );
489
+ Predicate predicate = spec .toPredicate (delete .from (getDomainClass ()), builder .createQuery (getDomainClass ()),
490
+ builder );
490
491
491
492
if (predicate != null ) {
492
493
delete .where (predicate );
@@ -524,7 +525,7 @@ private <S extends T, R> R doFindBy(Specification<T> spec, Class<T> domainClass,
524
525
TypedQuery <T > query = getQuery (specToUse , domainClass , sort );
525
526
526
527
if (scrollPosition instanceof OffsetScrollPosition offset ) {
527
- if (!offset .isInitial ()) {
528
+ if (!offset .isInitial ()) {
528
529
query .setFirstResult (Math .toIntExact (offset .getOffset ()) + 1 );
529
530
}
530
531
}
@@ -536,8 +537,8 @@ private <S extends T, R> R doFindBy(Specification<T> spec, Class<T> domainClass,
536
537
537
538
SpecificationScrollDelegate <T > scrollDelegate = new SpecificationScrollDelegate <>(scrollFunction ,
538
539
entityInformation );
539
- FetchableFluentQueryBySpecification <?, T > fluentQuery = new FetchableFluentQueryBySpecification <>(spec , domainClass , finder ,
540
- scrollDelegate , this ::count , this ::exists , this .entityManager , getProjectionFactory ());
540
+ FetchableFluentQueryBySpecification <?, T > fluentQuery = new FetchableFluentQueryBySpecification <>(spec , domainClass ,
541
+ finder , scrollDelegate , this ::count , this ::exists , this .entityManager , getProjectionFactory ());
541
542
542
543
return queryFunction .apply ((FetchableFluentQuery <S >) fluentQuery );
543
544
}
0 commit comments