java – HQL意外AST节点:

前端之家收集整理的这篇文章主要介绍了java – HQL意外AST节点:前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的代码无法注入下面的仓库.基于堆栈跟踪,似乎我的HQL语法无效,但我不知道我做错了什么.
@Repository
 public interface JobSetRepository extends JpaRepository<JobSetEntity,Integer> {
    @Modifying
    @Transactional
    @Query("UPDATE JobSetEntity SET workstation = :workstation,workflowProcess = :workstation.workflowProcess WHERE id = :jobSet.id")
    public Boolean updateWorkstation(@Param("jobSet") JobSetEntity jobSet,@Param("workstation") Workstation workstation);

    @Modifying
    @Transactional
    @Query("UPDATE JobSetEntity SET workflowProcess = :workflowProcess,workstation = null WHERE id = :jobSet.id")
    public Boolean updateWorkflowProcess(@Param("jobSet") JobSetEntity jobSet,@Param("workflowProcess") WorkflowProcess workflowProcess);
}

堆栈跟踪:

12:57:58,692 ERROR main org.hibernate.hql.internal.ast.ErrorCounter:54 - <AST>:1:111: unexpected AST node: :
12:57:58,693 ERROR main org.hibernate.hql.internal.ast.ErrorCounter:50 - <AST>:1:111: unexpected AST node: :
<AST>:1:111: unexpected AST node: :
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.addrExpr(HqlsqlBaseWalker.java:4680)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.addrExprLhs(HqlsqlBaseWalker.java:5114)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.addrExpr(HqlsqlBaseWalker.java:4575)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.expr(HqlsqlBaseWalker.java:1260)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.newValue(HqlsqlBaseWalker.java:1211)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.assignment(HqlsqlBaseWalker.java:1033)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.setClause(HqlsqlBaseWalker.java:747)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.updateStatement(HqlsqlBaseWalker.java:367)
    at org.hibernate.hql.internal.antlr.HqlsqlBaseWalker.statement(HqlsqlBaseWalker.java:255)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)

更新:我也收到此错误与此查询

@Query("UPDATE OrderEntity SET inProduction = :order.inProduction WHERE OrderEntity.id = :order.id")
void updateInProduction(@Param("order") OrderEntity order);

我更新了我的版本最新:

<dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.5.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.5.Final</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.3.4.RELEASE</version>
    </dependency>

更新:我也收到这个错误

@Query("SELECT oe FROM OrderEntity oe WHERE oe.id = :orderProductEntity.id")
OrderEntity findBy(@Param("orderProductEntity") OrderProductEntity orderProductEntity);
@H_403_21@解决方法
可悲的是,你不能做:order.inProduction(或者:foo.bar一般). Reference.

猜你在找的Java相关文章