Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ RSQLJPAContext findPropertyPath(String propertyPath, Path startRoot) {
classMetadata = getManagedElementCollectionType(mappedProperty, classMetadata);
String keyJoin = getKeyJoin(root, mappedProperty);
log.debug("Create a element collection join between [{}] and [{}] using key [{}]", previousClass, classMetadata.getJavaType().getName(), keyJoin);
root = join(keyJoin, root, mappedProperty);
root = join(keyJoin, root, mappedProperty, joinHints.get(keyJoin));
} else if (isJsonType(mappedProperty, classMetadata)) {
root = root.get(mappedProperty);
attribute = classMetadata.getAttribute(mappedProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,26 @@ public final void testElementCollection2() {
assertThat(rsql, count, is(4l));
}

@Test
public final void testElementCollection1WithJoinHints() {
final Map<String, JoinType> joinHints = new HashMap<String, JoinType>(){{put("Company.tags", JoinType.LEFT);}};
final String rsql = "tags!=tech,tags=na=''";
final List<Company> companies = companyRepository.findAll(toSpecification(rsql, null, joinHints));
final long count = companies.size();
log.info("rsql: {} -> count: {}", rsql, count);
assertThat(rsql, count, is(4L));
}

@Test
public final void testElementCollection2WithJoinHints() {
final Map<String, JoinType> joinHints = new HashMap<String, JoinType>(){{put("Company.bigTags", JoinType.LEFT);}};
final String rsql = "bigTags.tag!=tech,bigTags.tag=na=''";
final List<Company> companies = companyRepository.findAll(toSpecification(rsql, null, joinHints));
final long count = companies.size();
log.info("rsql: {} -> count: {}", rsql, count);
assertThat(rsql, count, is(4L));
}

@Test
public final void testToComplexMultiValueMap() {
String rsql = "sites.trunks.id==2,id=na=2,company.id=='2',id=na=3,name==''";
Expand Down