CUBA在查询语句如何添加参数
生活随笔
收集整理的這篇文章主要介紹了
CUBA在查询语句如何添加参数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在browse.xml中的collectionDatasource 可以添加查詢語句,使用 “= :custom$param”? 的形式
<collectionDatasource id="procActorsDs"class="com.haulmont.bpm.entity.ProcActor"view="procActor-browse"><query><![CDATA[select pa from bpm$ProcActor pa where pa.procInstance.id = :custom$procInstanceorder by pa.procRole.order, pa.order]]></query> </collectionDatasource>?
然后在后臺Controller類中添加這個參數,datasoure.refresh(params)
public void refresh() {Map<String, Object> params = new HashMap<>();params.put("procInstance", procInstance);procActorsDs.refresh(params); }?
如果是在后臺中查詢,那參數設置就跟JPQL很像了
public static ExcelTable findExcelTableById(DataManager dataManager, UUID entityId) {LoadContext ctx = LoadContext.create(ExcelTable.class).setView("_local");ctx.setQueryString("select et from cip$ExcelTable et where et.id = :entityId").setParameter("entityId", entityId);return (ExcelTable) dataManager.load(ctx); }?
總結
以上是生活随笔為你收集整理的CUBA在查询语句如何添加参数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring——AOP
- 下一篇: AGG第二课 代码框架以及命名规则