I have a object Report with among many other columns a report_XML column with a big XML, its heavy to retrieve it each time and I want to somehow omit it from the result set. How can I do so?
My question is similar to these, but they don’t answer the question fully. I know about Projections in Hibernate Criteria, but the problem with using them is that I in return get a list with object array, I want in return a list with objects of the given type the Criteria is made for, just with the fields I explicitly defined omitted, is that possible?
https://forum.hibernate.org/viewtopic.php?p=2410205
hibernate fetch specific column from database using criteria
Hibernate allows making any property laoded lazily. For basic properties (such as our XML property), bytecode instrumentation is needed though. This is all described in the documentation.
So, if you mark this property as laz and execute your query, The XML property won’t be loaded until you actually access the lazy property afterwards.