I want to run a query, but the results should be read only. And they might need a refresh, and I don't want to refresh each element in the list. I'd rather re-execute the query. Thus I want all the results to be detached. What I currently do is
List<Ent> lst = (List<Ent>)em.createQuery("FROM Ent").getResultList();
for (Ent l:lst) em.detach(l);
But it seems wrong to me.
Any better way to do that?