hello i have the following error ERROR: Invalid path: 'generatedAlias2.lib'
when i use a join from a fetch cast, and i use this join to build an order
In advance, thank you for your answer,
versions :
- hibernate 5.3.7.Final
- db Oracle 11
- jdk 8
example :
i want to make a fetch on the frns entity and a order on lib from the pays entity
Doesn’t work
CriteriaBuilder builder = session.getCriteriaBuilder();
CriteriaQuery query = builder.createQuery(Acfc.class);
Root root = query.from(Acfc.class);
Join<Acfc, Frns> joinAcfcfFrns = (Join) root.fetch(“frns”, JoinType.INNER);
Join<Frns, Pays> joinFrnsPays = joinAcfcfFrns.join(“pays”, JoinType.INNER);
query.orderBy(builder.asc(joinFrnsPays.get(“lib”)));
session.createQuery(query).setFirstResult(0).setMaxResults(10).getResultList();
Work’s fine without fetch cast
Join<Acfc, Frns> joinAcfcfFrns = root.join(“frns”, JoinType.INNER);
Join<Frns, Pays> joinFrnsPays = joinAcfcfFrns.join(“pays”, JoinType.INNER);
Work’s fine when all join are fetching
Join<Acfc, Frns> joinAcfcfFrns = (Join) root.fetch(“frns”, JoinType.INNER);
Join<Frns, Pays> joinFrnsPays = (Join) joinAcfcfFrns.fetch(“pays”, JoinType.INNER);
code snippet Entity Acfc
// frns
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FRNS", nullable = false)
private Frns frns;
code snippet Entity Frns
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PAYS", nullable = false)
private Pays pays;