How to fix SQL injection in Java Rest Controller

I am getting an sql injection error while trying to scan my code using checkmarks.I have tried to use metamodel but i don't think it's working properly for me.Also when i am trying to call the controller class using the metamodel from Junit it's showing

"excpected <200> but recieved <500> Assertion exception"

Below i my controller code

 public class SearchController implements SearchApi {

private static final Logger logger = LoggerFactory.getLogger(SearchController.class);

@Autowired
Service service;

@Override
@GetMapping(value = "jl-search")
public ResponseEntity<Page<SearchDto>> fetchJLSearch(@RequestParam(name = "stpId", required = true) Long stpId, @PageableDefault(page = 0, size = 10) Pageable pageable) {
    logger.info("Get JlEntries by stpId {}", stpId);
    return ResponseEntity.ok(service.fetchJlPageByCriteria(stpId, pageable));
   }

 }

Checkmarks is showing me that the stpId may cause SQL injection and making the code non complaint. I have created a meta model and tried to replace my code using that

@StaticMetamodel(JLDetails.class)
public abstract class JLDetails_ {
 
public static volatile SingularAttribute<JLDetails, String> stpId;
}

Replaced my controller code like that

 return ResponseEntity.ok(service.fetchJlPageByCriteria(JLDetails_.stpId, pageable));

Here is my test code

 @Test
public void testFetchJlSearch() throws Exception {
    when(service.fetchJlPageByCriteria(any(), any())).thenReturn(jlDetailDtoPage);
    mockMvc.perform(get(jlDetailsUrl)
            .param("stpId", "1234") //trying to call using this but getting exception and test is failing 
            .accept(MediaType.APPLICATION_JSON)
            .contentType(MediaType.APPLICATION_JSON))
            .andExpect(status().isOk())
            .andExpect(jsonPath("$." + "content[0].jledgerStagingId").value(100))
            .andExpect(jsonPath("$." + "content[0].stpId").value(200))
            .andExpect(jsonPath("$." + "content[0].userJeSourceName").value("CIS3"))
            .andExpect(jsonPath("$." + "content[0].userJeCategoryName").value("DISC"))
            .andExpect(jsonPath("$." + "content[0].accountingDate").value("2020-07-20"))
            .andExpect(jsonPath("$." + "content[0].enteredDr").value(200.4))

Anybody please let me know ,if i can fix this issue.Thanks in advance.