Skip to content

Commit f618000

Browse files
christophstroblmp911de
authored andcommittedNov 21, 2024
Deprecate JpaEntityGraph.isAdHocEntityGraph() method.
An EntityGraph without attributes is valid. Therefore it is not possible to determine if a given JpaEntityGraph is a dynamic one just by looking at the attributes alone. Original pull request: #3684 See #3682
1 parent 264ea10 commit f618000

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.springframework.data.jpa.repository.query;
1717

18-
import java.util.Arrays;
1918
import java.util.List;
2019

2120
import org.springframework.data.jpa.repository.EntityGraph;
@@ -29,12 +28,11 @@
2928
*
3029
* @author Thomas Darimont
3130
* @author Mark Paluch
31+
* @author Christoph Strobl
3232
* @since 1.6
3333
*/
3434
public class JpaEntityGraph {
3535

36-
private static String[] EMPTY_ATTRIBUTE_PATHS = {};
37-
3836
private final String name;
3937
private final EntityGraphType type;
4038
private final List<String> attributePaths;
@@ -46,8 +44,8 @@ public class JpaEntityGraph {
4644
* @param nameFallback must not be {@literal null} or empty.
4745
*/
4846
public JpaEntityGraph(EntityGraph entityGraph, String nameFallback) {
49-
this(StringUtils.hasText(entityGraph.value()) ? entityGraph.value() : nameFallback, entityGraph.type(), entityGraph
50-
.attributePaths());
47+
this(StringUtils.hasText(entityGraph.value()) ? entityGraph.value() : nameFallback, entityGraph.type(),
48+
entityGraph.attributePaths());
5149
}
5250

5351
/**
@@ -65,7 +63,7 @@ public JpaEntityGraph(String name, EntityGraphType type, @Nullable String[] attr
6563

6664
this.name = name;
6765
this.type = type;
68-
this.attributePaths = Arrays.asList(attributePaths == null ? EMPTY_ATTRIBUTE_PATHS : attributePaths);
66+
this.attributePaths = attributePaths != null ? List.of(attributePaths) : List.of();
6967
}
7068

7169
/**
@@ -99,9 +97,11 @@ public List<String> getAttributePaths() {
9997
/**
10098
* Return {@literal true} if this {@link JpaEntityGraph} needs to be generated on-the-fly.
10199
*
102-
* @return
100+
* @return {@literal true} if {@link #attributePaths} is not empty.
103101
* @since 1.9
102+
* @deprecated since 3.5 as the used evaluation does not represent whether a {@link JpaEntityGraph} is dynamic or not.
104103
*/
104+
@Deprecated(since = "3.5", forRemoval = true)
105105
public boolean isAdHocEntityGraph() {
106106
return !attributePaths.isEmpty();
107107
}

0 commit comments

Comments
 (0)
Please sign in to comment.