roger_rf wrote:
Hi slawek,
How are you performing your query? Are you using the Criteria API, or HQL? After seeing batmat's comment, I think a possible solution may be to create a special construtor for your Document class where the [titleAndContent] property is not initialized, and use that constructor in an HQL query projecting only the columns that you need.
Unfortunatelly i'm using Criteria API.
For me its better solution because i have complicated criteria conditions (many if statements) so criteria code just looks better than concatenation of dozens of strings.
Somme time ago i tried to use my own constructor... it worked well when constructor attributters were simple (Integer, String, ect.) but i needed to fetch somme Sets - i couldnt make it to work when constructor had Set perameter:/
but question remains:
why 'lazy = true' in my mapping or 'setFetchMode' in criteria doesnt work? Is it even possible to lazy load String collumn? Or mayby this works only for associated Objects that are mapped?