将 mariaDB 查询转换为 ColdBox 条件
Convert mariaDB query to ColdBox Criteria
我在将 mariaDB 查询转换为 criterbox criteriaBuilder 时遇到问题。我不太明白如何在 coldbox 中使用 criteriaBuilder 加入 multi table。这是我的 mariaDB 查询:
select TerminalInst.* from TerminalInst
inner join Terminal on TerminalInst.terminal_id = Terminal.id
inner join custinst on TerminalInst.custinst_id = custinst.instID
where Terminal.description like '%value%'
如何将此查询转换为 criteriaBuilder?请帮助我..
尝试这样的事情(在处理程序中):
property name="terminalInstService" inject="model:terminalInstService"; //for cbox 3.8.x
property name="terminalInstService" inject="model"; // for cbox 4.2.x
cr = terminalInstService.newCriteria();
cr.createAlias('terminals','t')
.createAlias('custinsts','c')
.ilike('t.description','%value%');
results = cr.list();
哪里
terminals = relationship name between TerminalInst and Terminal
custinsts = relationship name between TerminalInst and custinst
and ilike is for case in-sensitive like
我在将 mariaDB 查询转换为 criterbox criteriaBuilder 时遇到问题。我不太明白如何在 coldbox 中使用 criteriaBuilder 加入 multi table。这是我的 mariaDB 查询:
select TerminalInst.* from TerminalInst
inner join Terminal on TerminalInst.terminal_id = Terminal.id
inner join custinst on TerminalInst.custinst_id = custinst.instID
where Terminal.description like '%value%'
如何将此查询转换为 criteriaBuilder?请帮助我..
尝试这样的事情(在处理程序中):
property name="terminalInstService" inject="model:terminalInstService"; //for cbox 3.8.x
property name="terminalInstService" inject="model"; // for cbox 4.2.x
cr = terminalInstService.newCriteria();
cr.createAlias('terminals','t')
.createAlias('custinsts','c')
.ilike('t.description','%value%');
results = cr.list();
哪里
terminals = relationship name between TerminalInst and Terminal
custinsts = relationship name between TerminalInst and custinst
and ilike is for case in-sensitive like