首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有左手边的点节点

没有左手边的点节点
EN

Stack Overflow用户
提问于 2018-11-28 10:49:04
回答 1查看 466关注 0票数 0

我使用的是jinq版本1.8.11,hibernate版本4.3使用hibernate会话工厂,而不是实体管理器。

我正在尝试以下查询:

代码语言:javascript
复制
JPAJinqStream<Routine> routineStream = stream.streamAll(getCurrentSession(), Routine.class);

    if (text.isPresent()) {
        final String searchText = text.get();
        routineStream = routineStream
                .leftOuterJoin(
                        (r, source) -> source.stream(NLSProperty.class),
                        (r, nls) -> nls.getVarKey().equals("routine.100.title")
                ).select(pair -> pair.getOne());"%" + searchText + "%")).select(Pair::getOne);
    }
    List<Routine> tp = routineStream.toList();

当变量文本不存在时,查询工作正常,我将得到结果。当变量文本出现时,我将得到以下错误:

代码语言:javascript
复制
java.lang.IllegalStateException: DOT node with no left-hand-side!

知道我做错什么了吗?

我已经调试了jinq,它生成的查询如下所示:

代码语言:javascript
复制
SELECT A FROM de.etherapists.ehealth.model.routine.Routine A LEFT OUTER JOIN de.etherapists.ehealth.model.NLSProperty B ON B.varKey = 'routine.100.title';

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-29 12:50:10

好的,我将hibernate版本升级到5.1,仍然使用会话工厂,而不是实体管理器。

现在的代码是:

代码语言:javascript
复制
if (text.isPresent()) {
        routineStream = routineStream
                .leftOuterJoin(
                        (routine, source) -> source.stream(NLSProperty.class),
                        (routine, nls) -> routine.getTitle().equals(nls.getVarKey())
                )
                .where(pair -> JPQL.like(pair.getOne().getShortCode(), "%" + text + "%")
                        || JPQL.like(pair.getTwo().getVarValue(), "%" + text + "%"))
                .select(Pair::getOne)
    }

它就像一种魅力

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53517692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档