如何将以下SQL查询转换为HQL:
SELECT A.*,B.code,B.name
FROM ATABLE A, BTABLE B
WHERE B.some_id= A.some_id
Order By A.id;
我已经写了以下代码:
CriteriaBuilder criteria = em.getCriteriaBuilder();
CriteriaQuery<A> cq = criteria.createQuery(A.class);
Root<A> from = cq.from(A.class);
cq.select(from);
cq.orderBy(criteria.desc(from.get("id")));
TypedQuery<A> query = em.createQuery(cq);
但是下面的代码只允许我执行查询:
select * from A order by id;
您能帮我完成查询吗? 谢谢