如何使用 CriteriaBuilder 编写以下 sql 查询
当我想将查询写入标准生成器时遇到问题。或者是否更好地编写 SQL 查询以便更容易在条件生成器中编写?
select
DATA_TABLE.*, M_ORDER.CODE
from
( select
log0_.MSG_ID,
login1_.NAME,
log0_.METHOD,
logpa2_.VALUE
from
M_LOG log0_
inner join
M_LOG_INTER login1_
on log0_.ID_INTER=login1_.ID_INTER
inner join
M_PARAMS logpa2_
on log0_.MS_ID=logpa2_.MS_ID
where
logpa2_.KEY='id'
) DATA_TABLE, M_ORDER
WHERE
data.value = m_order.ID and
rownum <= 10;
I have problem while I want to write query into Criteria Builder. Or if is better to compose SQL query to be easyer to write in criteria builder ?
select
DATA_TABLE.*, M_ORDER.CODE
from
( select
log0_.MSG_ID,
login1_.NAME,
log0_.METHOD,
logpa2_.VALUE
from
M_LOG log0_
inner join
M_LOG_INTER login1_
on log0_.ID_INTER=login1_.ID_INTER
inner join
M_PARAMS logpa2_
on log0_.MS_ID=logpa2_.MS_ID
where
logpa2_.KEY='id'
) DATA_TABLE, M_ORDER
WHERE
data.value = m_order.ID and
rownum <= 10;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重构(简化)SQL 查询:
使用 CriteriaBuilder 进行查询很容易。
Restructured (simplified) SQL query:
And query with CriteriaBuilder was easly.