Skip to content

Commit 5b7673d

Browse files
committed
Graphpocalypse: deprecated funkily-named methods of Graph
All of these methods now exist in the JPA supertype, without the funky naming. We need to guide users away from the non-standard ones, especially in light of the ugliness.
1 parent 4251dd8 commit 5b7673d

File tree

8 files changed

+435
-142
lines changed

8 files changed

+435
-142
lines changed

hibernate-core/src/main/java/org/hibernate/graph/AttributeNode.java

+30-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77

88
import jakarta.persistence.Subgraph;
9-
import org.hibernate.metamodel.model.domain.ManagedDomainType;
9+
import jakarta.persistence.metamodel.ManagedType;
10+
import org.hibernate.Incubating;
1011
import org.hibernate.metamodel.model.domain.PersistentAttribute;
1112

1213
import java.util.Map;
@@ -51,13 +52,17 @@ public interface AttributeNode<J> extends GraphNode<J>, jakarta.persistence.Attr
5152

5253
/**
5354
* All value subgraphs rooted at this node.
55+
* <p>
56+
* Includes treated subgraphs.
5457
*
5558
* @see jakarta.persistence.AttributeNode#getSubgraphs
5659
*/
5760
Map<Class<?>, ? extends SubGraph<?>> getSubGraphs();
5861

5962
/**
6063
* All key subgraphs rooted at this node.
64+
* <p>
65+
* Includes treated subgraphs.
6166
*
6267
* @see jakarta.persistence.AttributeNode#getKeySubgraphs
6368
*/
@@ -89,27 +94,49 @@ public interface AttributeNode<J> extends GraphNode<J>, jakarta.persistence.Attr
8994
* Create and return a new value {@link SubGraph} rooted at this node,
9095
* with the given type, which may be a subtype of the value type,
9196
* or return an existing such {@link SubGraph} if there is one.
97+
* <p>
98+
* If the given type is a proper subtype of the value type, the result
99+
* is a treated subgraph.
100+
*
101+
* @param subtype The type or treated type of the value type
92102
*/
93103
<S> SubGraph<S> makeSubGraph(Class<S> subtype);
94104

95105
/**
96106
* Create and return a new value {@link SubGraph} rooted at this node,
97107
* with the given type, which may be a subtype of the key type,
98108
* or return an existing such {@link SubGraph} if there is one.
109+
* <p>
110+
* If the given type is a proper subtype of the key type, the result
111+
* is a treated subgraph.
112+
*
113+
* @param subtype The type or treated type of the key type
99114
*/
100115
<S> SubGraph<S> makeKeySubGraph(Class<S> subtype);
101116

102117
/**
103118
* Create and return a new value {@link SubGraph} rooted at this node,
104119
* with the given type, which may be a subtype of the value type,
105120
* or return an existing such {@link SubGraph} if there is one.
121+
* <p>
122+
* If the given type is a proper subtype of the value type, the result
123+
* is a treated subgraph.
124+
*
125+
* @param subtype The type or treated type of the value type
106126
*/
107-
<S> SubGraph<S> makeSubGraph(ManagedDomainType<S> subtype);
127+
@Incubating
128+
<S> SubGraph<S> makeSubGraph(ManagedType<S> subtype);
108129

109130
/**
110131
* Create and return a new value {@link SubGraph} rooted at this node,
111132
* with the given type, which may be a subtype of the key type,
112133
* or return an existing such {@link SubGraph} if there is one.
134+
* <p>
135+
* If the given type is a proper subtype of the key type, the result
136+
* is a treated subgraph.
137+
*
138+
* @param subtype The type or treated type of the key type
113139
*/
114-
<S> SubGraph<S> makeKeySubGraph(ManagedDomainType<S> subtype);
140+
@Incubating
141+
<S> SubGraph<S> makeKeySubGraph(ManagedType<S> subtype);
115142
}

hibernate-core/src/main/java/org/hibernate/graph/EntityGraphs.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public static <R> void setFetchGraph(TypedQuery<R> query, EntityGraph<R> graph)
141141
* @since 7.0
142142
*/
143143
public <S> Subgraph<S> addTreatedSubgraph(Graph<? super S> graph, Class<S> subtype) {
144-
return ((org.hibernate.graph.Graph<? super S>) graph).addTreatedSubGraph( subtype );
144+
return ((org.hibernate.graph.Graph<? super S>) graph).addTreatedSubgraph( subtype );
145145
}
146146

147147
/**

0 commit comments

Comments
 (0)