You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Blaze Persistence查询中实现多个根实体?

Blaze Persistence多根实体查询实现

原问题:根据Blaze Persistence官方文档说明,查询可支持多个根实体,但未找到具体的实现方式,请问该如何在Blaze Persistence查询中实现多个根实体?


补充:问题已解决

感谢Cristian的帮助,我实现了如下可运行的测试代码:

@Test
void testThownExceptionWhenUsingRelativePathWithMultipleQueryRoots() {

    // @formatter:off
    IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
        CriteriaBuilder<String> cb = cbf.create(em, String.class)
                .from(Cat.class, "c")
                .from(Person.class, "p")
                .select("name");
        List<String> cats = cb.getResultList();
    });
    // @formatter:on
}

内容的提问来源于stack exchange,提问作者ecormaksin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.02 15:36:05