|
8 | 8 | import com.beyt.util.SpecificationUtil; |
9 | 9 | import org.apache.commons.lang3.tuple.ImmutableTriple; |
10 | 10 | import org.apache.commons.lang3.tuple.Triple; |
11 | | -import org.hibernate.query.criteria.internal.path.RootImpl; |
12 | 11 | import org.springframework.data.jpa.domain.Specification; |
13 | 12 | import org.springframework.data.util.Pair; |
14 | 13 |
|
|
23 | 22 | public class DynamicSpecification<Entity> implements Specification<Entity> { |
24 | 23 |
|
25 | 24 | protected List<Criteria> criteriaList; |
26 | | - protected Map<Triple<String, String, JoinType>, Join<?, ?>> joinMap = new ConcurrentHashMap<>(); |
| 25 | + protected Map<Triple<From<?, ?>, String, JoinType>, Join<?, ?>> joinMap = new ConcurrentHashMap<>(); |
27 | 26 |
|
28 | 27 | public DynamicSpecification(List<Criteria> criteriaList) { |
29 | 28 | this.criteriaList = criteriaList; |
30 | 29 | this.joinMap = new ConcurrentHashMap<>(); |
31 | 30 | } |
32 | 31 |
|
33 | | - public DynamicSpecification(List<Criteria> criteriaList, Map<Triple<String, String, JoinType>, Join<?, ?>> joinMap) { |
| 32 | + public DynamicSpecification(List<Criteria> criteriaList, Map<Triple<From<?, ?>, String, JoinType>, Join<?, ?>> joinMap) { |
34 | 33 | this.criteriaList = criteriaList; |
35 | 34 | this.joinMap = joinMap; |
36 | 35 | } |
@@ -138,7 +137,7 @@ protected Predicate addPredicate(Path<?> root, CriteriaBuilder builder, Criteria |
138 | 137 | } |
139 | 138 |
|
140 | 139 | protected Join<?, ?> getJoin(From<?, ?> from, String key, JoinType joinType) { |
141 | | - Triple<String, String, JoinType> joinMapKey = new ImmutableTriple<>(((RootImpl) from).getEntityType().getJavaType().getName(), key, joinType); |
| 140 | + Triple<From<?, ?>, String, JoinType> joinMapKey = new ImmutableTriple<>(from, key, joinType); |
142 | 141 | if (joinMap.containsKey(joinMapKey)) { |
143 | 142 | return joinMap.get(joinMapKey); |
144 | 143 | } |
|
0 commit comments