HQL 中的内部联接查询
我无法为内部连接执行 HQL,查询在 sql 中执行正确,但在 HQL 中未执行。我不知道我在哪里失踪。您的帮助是可观的。
***Error***: org.hibernate.hql.ast.QuerySyntaxError: unexpected token: ON near line 1, column 148 [SELECT op.username, op.email, orders.p_id, orders.o_id, product.listed_price FROM com.model.Orders orders INNER JOIN orders.OrderProcessing as op ON op.u_id = orders.u_id INNER JOIN orders.Product as product ON product.p_id = orders.p_id WHERE product.p_id = '208' ORDER BY op.username]
productList = (List<Orders>) session.createQuery(
"SELECT op.username, op.email, orders.p_id, orders.o_id, product.listed_price " +
"FROM Orders orders " +
"INNER JOIN orders.OrderProcessing as op " +
"ON op.u_id = orders.u_id " +
"INNER JOIN orders.Product as product " +
"ON product.p_id = orders.p_id " +
"WHERE product.p_id = '"+p_id +"' " +
"ORDER BY op.username"
).list();