首页 > 解决方案 > 当我尝试在 Liferay 7.1 中使用 CostumSql 时出现“java.lang.IllegalArgumentException:位置参数不存在”异常

问题描述

我尝试使用 CostumSql,但出现以下异常:

引起:java.lang.IllegalArgumentException:位置参数不存在

这是我的查找器:

Session session = null;
try {
    session = openSession();

    String sql = _customSQL.get(getClass(),FIND_BY_KEYWORDS);

    SQLQuery q = session.createSQLQuery(sql);
    q.setCacheable(false);
    q.addEntity("BlockchainAccount",BlockchainAccountImpl.class);

    QueryPos qPos = QueryPos.getInstance(q);
    qPos.add(companyId);
    qPos.add(groupId);
    qPos.add(keywords);

    return (List<BlockchainAccount>) QueryUtil.list(
                        q, getDialect(), start, end);
}
catch (Exception e) {
    try {
        throw new SystemException(e);
    }
    catch (SystemException se) {
        se.printStackTrace();
    }
}
finally {
    closeSession(session);
}

return null;

标签: javasqlexceptionliferay

解决方案


推荐阅读