public Customer[] getCustomersAll() { System.out.println("getCustomers: all"); Query query = null; try { query = entityMgr.createNamedQuery("getCustomers"); List beanlist = query.getResultList(); Customer[] array = new Customer[beanlist.size()]; return beanlist.toArray(array); } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); return null; } }