Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Panes Error in Relationship Table #159

Open
FluffyKnight2002 opened this issue Mar 28, 2024 · 3 comments
Open

Search Panes Error in Relationship Table #159

FluffyKnight2002 opened this issue Mar 28, 2024 · 3 comments

Comments

@FluffyKnight2002
Copy link

I can use search panes with data from relationship entity.

@RequestMapping(value = "/employees-searchpanes-basic", method = RequestMethod.POST)
public DataTablesOutput listWithBasicSearchPanes(@Valid DataTablesInput input, @RequestParam Map<String, String> queryParameters) {
input.parseSearchPanesFromQueryParams(queryParameters, Arrays.asList("position", "office.city"));
return employeeRepository.findAll(input);
}

I want to use office.city in SearchPanes and but when i use like this,
'DataTables warning: table id=employees - java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: Could not resolve attribute 'office.city' of 'sample.employee.Employee'
that error happen. How do i fix that?

@darrachequesne
Copy link
Owner

I could indeed reproduce the issue. It seems there is a mistake here:

query.multiselect(root.get(attribute), criteriaBuilder.count(root));
query.groupBy(root.get(attribute));

I think root.get(attribute) (here, root.get("office.city")) is not valid, the string should be split into root.get("office").get("city"). Would you have time to create a PR?

@FluffyKnight2002
Copy link
Author

i dont know how to do that?

@darrachequesne
Copy link
Owner

This should be fixed by 495cfbc, which was included in version 6.0.4. Could you please check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants