Advertisement
Guest User

Untitled

a guest
May 24th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. id, name_a
  2.  
  3. id, name_b
  4.  
  5. id_a, id_b
  6.  
  7. Specification<TableA> specification = (root, query, cb) -> {
  8. CriteriaQuery<TableAb> abQuery = cb.createQuery(TableAb.class);
  9. CriteriaQuery<TableB> bQuery = cb.createQuery(TableB.class);
  10.  
  11. Root<TableAb> abRoot = abQuery.from(TableAb.class);
  12. Join<TableAb, TableA> aJoin = abRoot.join("tableA");
  13. Join<TableAb, TableB> bJoin = abRoot.join("tableB");
  14.  
  15. //combine joins
  16.  
  17. query.orderBy(cb.asc(/* Expression to order by */));
  18. return cb.conjunction();
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement