List of usage examples for javax.persistence TypedQuery setFlushMode
TypedQuery<X> setFlushMode(FlushModeType flushMode);
From source file:sf.net.experimaestro.scheduler.Scheduler.java
/** * Iterator on resources//w w w.ja va 2 s. co m */ public CloseableIterable<Resource> resources() { final List<Resource> resultList = Transaction.evaluate(em -> { TypedQuery<Resource> query = em.createQuery("from resources", Resource.class); query.setFlushMode(FlushModeType.AUTO); return query.getResultList(); }); return new CloseableIterable<Resource>() { @Override public void close() throws CloseException { } @Override public Iterator<Resource> iterator() { return resultList.iterator(); } }; }