1515 */
1616package net .kaczmarzyk .spring .data .jpa .web ;
1717
18+ import net .kaczmarzyk .spring .data .jpa .utils .Alias ;
1819import net .kaczmarzyk .spring .data .jpa .utils .QueryContext ;
1920import org .apache .commons .lang3 .tuple .Pair ;
2021
3132 */
3233public class DefaultQueryContext implements QueryContext {
3334
34- private Map <String , Function <Root <?>, Join <?, ?>>> contextMap ;
35+ private Map <Alias , Function <Root <?>, Join <?, ?>>> contextMap ;
3536 private Map <String , Fetch <?, ?>> evaluatedJoinFetch ;
3637
37- private Map <Pair < String , Root > , Join <?, ?>> rootCache ;
38+ private Map <Alias , Join <?, ?>> rootCache ;
3839
3940 public DefaultQueryContext () {
4041 this .contextMap = new HashMap <>();
@@ -44,18 +45,18 @@ public DefaultQueryContext() {
4445
4546 @ Override
4647 public boolean existsJoin (String key , Root <?> root ) {
47- return contextMap .containsKey (key );
48+ return contextMap .containsKey (Alias . of ( key , root ) );
4849 }
4950
5051 @ Override
5152 public Join <?, ?> getEvaluated (String key , Root <?> root ) {
52- Function <Root <?>, Join <?, ?>> value = contextMap .get (key );
53+ Function <Root <?>, Join <?, ?>> value = contextMap .get (Alias . of ( key , root ) );
5354
5455 if (value == null ) {
5556 return null ;
5657 }
5758
58- Pair < String , Root > rootKey = Pair .of (key , root );
59+ Alias rootKey = Alias .of (key , root );
5960
6061 if (!rootCache .containsKey (rootKey )) {
6162 Join <?, ?> evaluated = value .apply (root );
@@ -65,7 +66,7 @@ public boolean existsJoin(String key, Root<?> root) {
6566 }
6667
6768 @ Override
68- public void putLazyVal (String key , Function <Root <?>, Join <?, ?>> value ) {
69+ public void putLazyVal (Alias key , Function <Root <?>, Join <?, ?>> value ) {
6970 contextMap .put (key , value );
7071 }
7172
0 commit comments