| This would be for people who would like to return a partially loaded entity graph and not trigger a lazy load exception. Once the entity is in a detached state it would just return a null value if the proxy or collection is unloaded. It would be similar to the readOnly hint.
.setHint("org.hibernate.PojoAfterDetach", true)
The default would be false. A common paradigm would be for web services developers who just want to return some data for viewing would use both hints.
List<Customer> list = em.createQuery(q, Customer.class)
.setHint("org.hibernate.readOnly", true)
.setHint("org.hibernate.PojoAfterDetach", true)
.getResultList();
Then you do not have to worry about the various serialization frameworks triggering lazy load exceptions. |