Click here to Skip to main content
15,747,637 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Its my first time using angular and java. So Im learning from tasks. I already made a call from frontend to backend to retrieve a count number (sends number from frontend, searches the database and return the output from the query). Now I have a similar task to send the same number to backend but now when searching the database I receive 4 string returns and have to send that to frontend to output it. The problem is I don't know how to send 2 gets on the same endpoint.


public PayloadResponse<long> getCount(EntityRequest<long> request);


    public PayloadResponse<long> getCount(EntityRequest<long> request) {
        Long itemId = request.getEntity();
        Long count = itemDAO.getCount(itemId);
        PayloadResponse<long> response = new PayloadResponse<>(request, ResponseCode.OK, count);
        return response;


    public PayloadResponse<long> getCount(@PathVariable Long itemId) {
        var request = new EntityRequest<>(itemId);
        return itemService.getCount(request);


public Long getCount(Long itemId) {
        String hql = "select count( distinct from ItemEntity i join MapTileResourceEntity mtr on mtr.resourceId = :itemId "
                + "and mtr.resourceType = :resourceType join MapTileEntity mt on = join MapEntity m on =";
        TypedQuery<long> query = entityManager.createQuery(hql, Long.class).setParameter("itemId", itemId).setParameter("resourceType",
        return query.getSingleResult();

What I have tried:

I tried making 2 getters with the same endpoint in frontend but it doesnt work
Updated 5-Jun-23 9:28am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900