简体   繁体   中英

How to order by fetch column?

How to order by fetch column?

My predicate:

CriteriaQuery<Connection> cquery = (CriteriaQuery<Connection>) query;
Fetch<Connection, ConnectionResearch> researches = root.fetch(Connection_.researches, JoinType.INNER);
cquery.orderBy(cb.asc( /* researches.get(ConnectionResearch_.pullforce) */ ));

How to set select query order by ConnectionResearch.pullforce fetch column?

Solution:

Join<Connection, ConnectionResearch> researches = (Join<Connection, ConnectionResearch>) root.fetch(Connection_.researches);
cquery.orderBy(cb.asc(researches.get(ConnectionResearch_.pullForce)));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM