Skip to content

Commit 64dcdc1

Browse files
committed
Remove deprecated API that is marked for removal.
Closes #4057
1 parent a328989 commit 64dcdc1

File tree

5 files changed

+42
-147
lines changed

5 files changed

+42
-147
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*/
1616
package org.springframework.data.jpa.repository.query;
1717

18-
import static org.springframework.data.jpa.repository.query.JSqlParserUtils.*;
1918
import static org.springframework.data.jpa.repository.query.QueryUtils.*;
2019

2120
import net.sf.jsqlparser.expression.Alias;
2221
import net.sf.jsqlparser.expression.Expression;
2322
import net.sf.jsqlparser.expression.Function;
23+
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
2424
import net.sf.jsqlparser.parser.CCJSqlParser;
2525
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
2626
import net.sf.jsqlparser.parser.ParseException;
@@ -590,4 +590,43 @@ private static <T> T deserializeRequired(byte @Nullable [] bytes, Class<T> type)
590590
throw new IllegalStateException("Failed to deserialize object type");
591591
}
592592

593+
/**
594+
* Generates a count function call, based on the {@code countFields}.
595+
*
596+
* @param countFields the non-empty list of fields that are used for counting
597+
* @param distinct if it should be a distinct count
598+
* @return the generated count function call
599+
*/
600+
private static Function getJSqlCount(List<String> countFields, boolean distinct) {
601+
602+
List<Expression> countColumns = new ArrayList<>(countFields.size());
603+
for (String countField : countFields) {
604+
Column column = new Column(countField);
605+
countColumns.add(column);
606+
}
607+
608+
ExpressionList<Expression> countExpression = new ExpressionList<>(countColumns);
609+
610+
return new Function() //
611+
.withName("count") //
612+
.withParameters(countExpression) //
613+
.withDistinct(distinct);
614+
}
615+
616+
/**
617+
* Generates a lower function call, based on the {@code column}.
618+
*
619+
* @param column the non-empty column to use as param for lower
620+
* @return the generated lower function call
621+
*/
622+
private static Function getJSqlLower(String column) {
623+
624+
List<Expression> expressions = Collections.singletonList(new Column(column));
625+
ExpressionList<Expression> lowerParamExpression = new ExpressionList<>(expressions);
626+
627+
return new Function() //
628+
.withName("lower") //
629+
.withParameters(lowerParamExpression);
630+
}
631+
593632
}

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserUtils.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaEntityGraph.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
import java.util.List;
1919

20-
import org.springframework.data.jpa.repository.EntityGraph;
21-
2220
import org.jspecify.annotations.Nullable;
21+
22+
import org.springframework.data.jpa.repository.EntityGraph;
2323
import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType;
2424
import org.springframework.util.Assert;
2525
import org.springframework.util.StringUtils;
@@ -95,18 +95,6 @@ public List<String> getAttributePaths() {
9595
return attributePaths;
9696
}
9797

98-
/**
99-
* Return {@literal true} if this {@link JpaEntityGraph} needs to be generated on-the-fly.
100-
*
101-
* @return {@literal true} if {@link #attributePaths} is not empty.
102-
* @since 1.9
103-
* @deprecated since 3.5 as the used evaluation does not represent whether a {@link JpaEntityGraph} is dynamic or not.
104-
*/
105-
@Deprecated(since = "3.5", forRemoval = true)
106-
public boolean isAdHocEntityGraph() {
107-
return !attributePaths.isEmpty();
108-
}
109-
11098
@Override
11199
public String toString() {
112100
return "JpaEntityGraph [name=" + name + ", type=" + type + ", attributePaths=" + attributePaths.toString() + "]";

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -682,17 +682,6 @@ public static boolean hasNamedParameter(Query query) {
682682
return false;
683683
}
684684

685-
/**
686-
* Returns whether the given query contains named parameters.
687-
*
688-
* @param query can be {@literal null} or empty.
689-
* @return whether the given query contains named parameters.
690-
*/
691-
@Deprecated
692-
static boolean hasNamedParameter(@Nullable String query) {
693-
return StringUtils.hasText(query) && NAMED_PARAMETER.matcher(query).find();
694-
}
695-
696685
/**
697686
* Turns the given {@link Sort} into {@link jakarta.persistence.criteria.Order}s.
698687
*

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/CustomHsqlHibernateJpaVendorAdaptor.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)