Skip to content

Commit 037d584

Browse files
authored
Fix 157 inconsistent data handling with embedded entities (#161)
1 parent 20e2cc4 commit 037d584

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

rsql-jpa/src/main/java/io/github/perplexhub/rsql/RSQLJPAContext.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
import javax.persistence.criteria.Path;
44
import javax.persistence.metamodel.Attribute;
5+
import javax.persistence.metamodel.ManagedType;
56

67
import lombok.Value;
78

89
@Value(staticConstructor = "of")
910
class RSQLJPAContext {
1011

11-
private Path<?> path;
12-
private Attribute<?, ?> attribute;
12+
Path<?> path;
13+
Attribute<?, ?> attribute;
14+
ManagedType<?> managedType;
1315

1416
}

rsql-jpa/src/main/java/io/github/perplexhub/rsql/RSQLJPAPredicateConverter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ RSQLJPAContext findPropertyPath(String propertyPath, Path startRoot) {
7272
RSQLJPAContext context = findPropertyPath(mappedProperty, root);
7373
root = context.getPath();
7474
attribute = context.getAttribute();
75+
classMetadata = context.getManagedType();
7576
} else {
7677
if (!hasPropertyName(mappedProperty, classMetadata)) {
7778
if (Modifier.isAbstract(classMetadata.getJavaType().getModifiers())) {
@@ -153,7 +154,7 @@ RSQLJPAContext findPropertyPath(String propertyPath, Path startRoot) {
153154
accessControl(type, attribute.getName());
154155
}
155156

156-
return RSQLJPAContext.of(root, attribute);
157+
return RSQLJPAContext.of(root, attribute, classMetadata);
157158
}
158159

159160
private String getKeyJoin(Path<?> root, String mappedProperty) {

0 commit comments

Comments
 (0)