Skip to content

Commit fe55376

Browse files
author
talhadilber
committed
casting exception fixed
1 parent d6bf89b commit fe55376

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<groupId>io.github.tdilber</groupId>
1515
<artifactId>spring-jpa-dynamic-query</artifactId>
16-
<version>0.2.4</version>
16+
<version>0.2.5</version>
1717
<packaging>jar</packaging>
1818
<name>Spring Jpa Dynamic Query</name>
1919
<description>Spring Jpa Dynamic Query Project</description>

src/main/java/com/beyt/query/DynamicSpecification.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.beyt.util.SpecificationUtil;
99
import org.apache.commons.lang3.tuple.ImmutableTriple;
1010
import org.apache.commons.lang3.tuple.Triple;
11-
import org.hibernate.query.criteria.internal.path.RootImpl;
1211
import org.springframework.data.jpa.domain.Specification;
1312
import org.springframework.data.util.Pair;
1413

@@ -23,14 +22,14 @@
2322
public class DynamicSpecification<Entity> implements Specification<Entity> {
2423

2524
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<>();
2726

2827
public DynamicSpecification(List<Criteria> criteriaList) {
2928
this.criteriaList = criteriaList;
3029
this.joinMap = new ConcurrentHashMap<>();
3130
}
3231

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) {
3433
this.criteriaList = criteriaList;
3534
this.joinMap = joinMap;
3635
}
@@ -138,7 +137,7 @@ protected Predicate addPredicate(Path<?> root, CriteriaBuilder builder, Criteria
138137
}
139138

140139
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);
142141
if (joinMap.containsKey(joinMapKey)) {
143142
return joinMap.get(joinMapKey);
144143
}

0 commit comments

Comments
 (0)