I use Intellij but I do not know the reason why I always get the following error:
"status" is provided externally to the method and not sanitized before use.
My method:
...
public List getActionIdByTypeAndCodeAndStatus(String type, String code, String status) throws Exception {
String sql = "select action_id from action where type = '" + type + "' and code = '" + code + "' and status = '" + status + "' ";
Query checkWriteLog = entityManager.createNativeQuery(sql);
return checkWriteLog.getResultList();
}
The line which throws the error is
Query checkWriteLog = entityManager.createNativeQuery(sql);
Question: Do you know the reason? How can I fix it?