I’ve made an entity read-only after retrieving it using:
Session session = (Session)entityManager.getDelegate();
session.setReadOnly( entity, makeReadOnly );
I’d like to be able to test whether this object and its lazy-loaded children are, in fact, read-only programmatically but I don’t see any API to do that. Does such an API exist?
Update: I’m using Hibernate 3.3.1
There’s Session.isReadOnly(Object entityOrProxy) for that.
edit:
Ugly hack for 3.3.1: