I don't follow. Why would loading entities in a method which doesn't support transactions make things read only? Am I missing something? (And what "optimization" are you trying to get by making these entities read only?)
I dont know,
according to hibernate spec there are some optimizations when using something like
@org.hibernate.annotations.Immutable on a class or collection.
I have a large query which contains only entities for read-only (reporting things), so I want to bypass the overhead of entitymanager:
I dont want that the persistence provider has the overhead to manage my entities as they are only read-only.
There's nothing in JPA for this, as far as I am aware. Hibernate supports read only queries, which changes the update checking logic (which would make them slightly more efficient). Its a specific query hint you use for this though.