@@ -223,13 +223,13 @@ public void deleteAllByIdInBatch(Iterable<ID> ids) {
223223 }
224224
225225 if (entityInformation .hasCompositeId ()) {
226- // XXX Hibernate just creates an empty Entity when doing the getById.
227- // Others might do a select right away causing a big performance penalty.
228- // See JavaDoc for getById.
226+
229227 List <T > entities = new ArrayList <>();
228+ // generate entity (proxies) without accessing the database.
230229 ids .forEach (id -> entities .add (getById (id )));
231230 deleteAllInBatch (entities );
232231 } else {
232+
233233 String queryString = String .format (DELETE_ALL_QUERY_BY_ID_STRING , entityInformation .getEntityName (),
234234 entityInformation .getIdAttribute ().getName ());
235235
@@ -418,7 +418,7 @@ public List<T> findAllById(Iterable<ID> ids) {
418418
419419 if (entityInformation .hasCompositeId ()) {
420420
421- List <T > results = new ArrayList <T >();
421+ List <T > results = new ArrayList <>();
422422
423423 for (ID id : ids ) {
424424 findById (id ).ifPresent (results ::add );
@@ -429,7 +429,7 @@ public List<T> findAllById(Iterable<ID> ids) {
429429
430430 Collection <ID > idCollection = Streamable .of (ids ).toList ();
431431
432- ByIdsSpecification <T > specification = new ByIdsSpecification <T >(entityInformation );
432+ ByIdsSpecification <T > specification = new ByIdsSpecification <>(entityInformation );
433433 TypedQuery <T > query = getQuery (specification , Sort .unsorted ());
434434
435435 return query .setParameter (specification .parameter , idCollection ).getResultList ();
@@ -452,7 +452,7 @@ public List<T> findAll(Sort sort) {
452452 public Page <T > findAll (Pageable pageable ) {
453453
454454 if (isUnpaged (pageable )) {
455- return new PageImpl <T >(findAll ());
455+ return new PageImpl <>(findAll ());
456456 }
457457
458458 return findAll ((Specification <T >) null , pageable );
@@ -489,7 +489,7 @@ public List<T> findAll(@Nullable Specification<T> spec) {
489489 public Page <T > findAll (@ Nullable Specification <T > spec , Pageable pageable ) {
490490
491491 TypedQuery <T > query = getQuery (spec , pageable );
492- return isUnpaged (pageable ) ? new PageImpl <T >(query .getResultList ())
492+ return isUnpaged (pageable ) ? new PageImpl <>(query .getResultList ())
493493 : readPage (query , getDomainClass (), pageable , spec );
494494 }
495495
@@ -511,7 +511,7 @@ public <S extends T> Optional<S> findOne(Example<S> example) {
511511
512512 try {
513513 return Optional
514- .of (getQuery (new ExampleSpecification <S >(example , escapeCharacter ), example .getProbeType (), Sort .unsorted ())
514+ .of (getQuery (new ExampleSpecification <>(example , escapeCharacter ), example .getProbeType (), Sort .unsorted ())
515515 .getSingleResult ());
516516 } catch (NoResultException e ) {
517517 return Optional .empty ();
@@ -525,7 +525,7 @@ public <S extends T> Optional<S> findOne(Example<S> example) {
525525 @ Override
526526 public <S extends T > long count (Example <S > example ) {
527527 return executeCountQuery (
528- getCountQuery (new ExampleSpecification <S >(example , escapeCharacter ), example .getProbeType ()));
528+ getCountQuery (new ExampleSpecification <>(example , escapeCharacter ), example .getProbeType ()));
529529 }
530530
531531 /*
@@ -549,7 +549,7 @@ public <S extends T> boolean exists(Example<S> example) {
549549 */
550550 @ Override
551551 public <S extends T > List <S > findAll (Example <S > example ) {
552- return getQuery (new ExampleSpecification <S >(example , escapeCharacter ), example .getProbeType (), Sort .unsorted ())
552+ return getQuery (new ExampleSpecification <>(example , escapeCharacter ), example .getProbeType (), Sort .unsorted ())
553553 .getResultList ();
554554 }
555555
@@ -559,7 +559,7 @@ public <S extends T> List<S> findAll(Example<S> example) {
559559 */
560560 @ Override
561561 public <S extends T > List <S > findAll (Example <S > example , Sort sort ) {
562- return getQuery (new ExampleSpecification <S >(example , escapeCharacter ), example .getProbeType (), sort ).getResultList ();
562+ return getQuery (new ExampleSpecification <>(example , escapeCharacter ), example .getProbeType (), sort ).getResultList ();
563563 }
564564
565565 /*
@@ -636,7 +636,7 @@ public <S extends T> List<S> saveAll(Iterable<S> entities) {
636636
637637 Assert .notNull (entities , "Entities must not be null!" );
638638
639- List <S > result = new ArrayList <S >();
639+ List <S > result = new ArrayList <>();
640640
641641 for (S entity : entities ) {
642642 result .add (save (entity ));
@@ -676,7 +676,6 @@ public void flush() {
676676 * @param query must not be {@literal null}.
677677 * @param spec can be {@literal null}.
678678 * @param pageable must not be {@literal null}.
679- * @return
680679 * @deprecated use {@link #readPage(TypedQuery, Class, Pageable, Specification)} instead
681680 */
682681 @ Deprecated
@@ -692,7 +691,6 @@ protected Page<T> readPage(TypedQuery<T> query, Pageable pageable, @Nullable Spe
692691 * @param domainClass must not be {@literal null}.
693692 * @param spec can be {@literal null}.
694693 * @param pageable can be {@literal null}.
695- * @return
696694 */
697695 protected <S extends T > Page <S > readPage (TypedQuery <S > query , final Class <S > domainClass , Pageable pageable ,
698696 @ Nullable Specification <S > spec ) {
@@ -711,7 +709,6 @@ protected <S extends T> Page<S> readPage(TypedQuery<S> query, final Class<S> dom
711709 *
712710 * @param spec can be {@literal null}.
713711 * @param pageable must not be {@literal null}.
714- * @return
715712 */
716713 protected TypedQuery <T > getQuery (@ Nullable Specification <T > spec , Pageable pageable ) {
717714
@@ -725,7 +722,6 @@ protected TypedQuery<T> getQuery(@Nullable Specification<T> spec, Pageable pagea
725722 * @param spec can be {@literal null}.
726723 * @param domainClass must not be {@literal null}.
727724 * @param pageable must not be {@literal null}.
728- * @return
729725 */
730726 protected <S extends T > TypedQuery <S > getQuery (@ Nullable Specification <S > spec , Class <S > domainClass ,
731727 Pageable pageable ) {
@@ -739,7 +735,6 @@ protected <S extends T> TypedQuery<S> getQuery(@Nullable Specification<S> spec,
739735 *
740736 * @param spec can be {@literal null}.
741737 * @param sort must not be {@literal null}.
742- * @return
743738 */
744739 protected TypedQuery <T > getQuery (@ Nullable Specification <T > spec , Sort sort ) {
745740 return getQuery (spec , getDomainClass (), sort );
@@ -751,7 +746,6 @@ protected TypedQuery<T> getQuery(@Nullable Specification<T> spec, Sort sort) {
751746 * @param spec can be {@literal null}.
752747 * @param domainClass must not be {@literal null}.
753748 * @param sort must not be {@literal null}.
754- * @return
755749 */
756750 protected <S extends T > TypedQuery <S > getQuery (@ Nullable Specification <S > spec , Class <S > domainClass , Sort sort ) {
757751
@@ -772,7 +766,6 @@ protected <S extends T> TypedQuery<S> getQuery(@Nullable Specification<S> spec,
772766 * Creates a new count query for the given {@link Specification}.
773767 *
774768 * @param spec can be {@literal null}.
775- * @return
776769 * @deprecated override {@link #getCountQuery(Specification, Class)} instead
777770 */
778771 @ Deprecated
@@ -785,7 +778,6 @@ protected TypedQuery<Long> getCountQuery(@Nullable Specification<T> spec) {
785778 *
786779 * @param spec can be {@literal null}.
787780 * @param domainClass must not be {@literal null}.
788- * @return
789781 */
790782 protected <S extends T > TypedQuery <Long > getCountQuery (@ Nullable Specification <S > spec , Class <S > domainClass ) {
791783
@@ -801,7 +793,7 @@ protected <S extends T> TypedQuery<Long> getCountQuery(@Nullable Specification<S
801793 }
802794
803795 // Remove all Orders the Specifications might have applied
804- query .orderBy (Collections .< Order > emptyList ());
796+ query .orderBy (Collections .emptyList ());
805797
806798 return em .createQuery (query );
807799 }
@@ -812,7 +804,6 @@ protected <S extends T> TypedQuery<Long> getCountQuery(@Nullable Specification<S
812804 * @param spec can be {@literal null}.
813805 * @param domainClass must not be {@literal null}.
814806 * @param query must not be {@literal null}.
815- * @return
816807 */
817808 private <S , U extends T > Root <U > applySpecificationToCriteria (@ Nullable Specification <U > spec , Class <U > domainClass ,
818809 CriteriaQuery <S > query ) {
@@ -858,7 +849,6 @@ private void applyQueryHints(Query query) {
858849 * Executes a count query and transparently sums up all values returned.
859850 *
860851 * @param query must not be {@literal null}.
861- * @return
862852 */
863853 private static long executeCountQuery (TypedQuery <Long > query ) {
864854
@@ -930,8 +920,8 @@ private static class ExampleSpecification<T> implements Specification<T> {
930920 /**
931921 * Creates new {@link ExampleSpecification}.
932922 *
933- * @param example
934- * @param escapeCharacter
923+ * @param example the example to base the specification of. Must not be {@literal null}.
924+ * @param escapeCharacter the escape character to use for like expressions. Must not be {@literal null}.
935925 */
936926 ExampleSpecification (Example <T > example , EscapeCharacter escapeCharacter ) {
937927
0 commit comments