Customize the Controller method that handles the related request:
1: Push-in the controller method you,e.g. show
method
2: Modify that method run the query and place the result available for view layer:
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String show(@PathVariable("id") Long id, Model uiModel) {
...
Long count = UserAccount.countUserAccounts();
uiModel.addAttribute("countUserAccounts", count);
...
}
3: Modify the jspx as needed.