org.hibernate.hql.internal.ast.QuerySyntaxException:连接异常的预期路径
org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join exeption
我正在尝试使用休眠编写 jpql 查询。我在@Repository
中有这样的查询
@Query(value = "select p from Product p inner join ProductsUser pu on p.prosuctId = pu.productId where pu.userId = :uuid")
但是我得到一个例外
Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join! [select p from com.example.api.dto.ProductDto p inner join ProductsUsersDto pu on p.prosuctId = pu.productId where pu.userId = :uuid]
您不需要指定 JOIN ... ON
-子句,因为它已在实体 类 中配置。所以查询比较简单,像这样:
@Query("select p from Product p join p.productsUser pu where pu.userId = :uuid")
我正在尝试使用休眠编写 jpql 查询。我在@Repository
中有这样的查询@Query(value = "select p from Product p inner join ProductsUser pu on p.prosuctId = pu.productId where pu.userId = :uuid")
但是我得到一个例外
Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join! [select p from com.example.api.dto.ProductDto p inner join ProductsUsersDto pu on p.prosuctId = pu.productId where pu.userId = :uuid]
您不需要指定 JOIN ... ON
-子句,因为它已在实体 类 中配置。所以查询比较简单,像这样:
@Query("select p from Product p join p.productsUser pu where pu.userId = :uuid")