Collections QueryDsl-集合表达式中的动态子查询
我只是想用SpringDataJPA和QueryDSL为下面描述的场景寻找一些想法。 我想翻译以下声明Collections QueryDsl-集合表达式中的动态子查询,collections,expression,querydsl,Collections,Expression,Querydsl,我只是想用SpringDataJPA和QueryDSL为下面描述的场景寻找一些想法。 我想翻译以下声明 select * from document doc1 where doc1.name = <name> and doc1.date in ( (select max(doc2.date) from document doc2 where doc2.type = <type2>) , (select max(doc3.date) from document doc3
select * from document doc1
where doc1.name = <name> and doc1.date in (
(select max(doc2.date) from document doc2 where doc2.type = <type2>) ,
(select max(doc3.date) from document doc3 where doc3.type = <type3>) )
进入查询DSL。姓名和类型1。。typen作为参数传递。如您所见,查询应获取特定类型文档的maxdate。以下操作应有效
query.select(doc1).from(doc1)
.where(doc1.date.in(
subquery.select(doc2.date.max())
.from(doc2).where(doc2.type.in(...)))
.fetch()
嗨,提莫,谢谢你的回复。我无法解决我的问题。我看起来像这样:query.fromdoc1.wheredoc1.name.eqparam1.wheredoc1.date.in,