I'm trying to load some entities as read-only, I noticed that I have some options to do that, like @Immutable and also read-only in query.
My main question is what's the difference between setHint:
getEntityManager().createQuery("SELECT p FROM Post p").setHint(QueryHints.READ_ONLY, true).getResultList();
And setReadOnly:
Query query = session.createQuery("SELECT p FROM Post p");
query.setReadOnly(true);
query.list();
Are they the same thing?