SHARE
TWEET

Untitled

a guest Jun 18th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. em.getTransaction().begin();
  2.  
  3.         List<Address> addresses = em.createQuery("SELECT a FROM Address a ORDER BY a.employees.size DESC, a.town.id ASC",Address.class)
  4.                 .setMaxResults(10).getResultList();
  5.  
  6.         for (Address address : addresses) {
  7.  
  8.             System.out.printf("%s, %s - %d employees%n",
  9.                     address.getText(),
  10.                     address.getTown().getName(),
  11.                     address.getEmployees().size());
  12.         }
  13.  
  14.         em.getTransaction().commit();
  15.         em.close();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top