skalinic wrote:
The only reason I could think one would want to slice an object like that is to avoid initializing the third field ("c" in your example) to save memory.
actually I was thinking about performance issues. I have db table with 120 fields and I must scan it checking only few values. There are also extreme conditions when all values I use are indexed, so db engine does not have to get table data (only index values)
second thing is code/configuration bloat and possible mistakes when I have to put returned tuples into POJOs so I can write code: 'if (a.getValueX().equals(b.getValueY())', instead of meaningless 'if (taba[5].equals(tabb[3]))'
third: it is easy (in my approach and lazy loading one) to add field 'Foo' in HQL's select and right away use it few lines below by simple getFoo() statement. Though, lazy loading will need extra configuration...
Also I am afraid of "loading at demand" because I exactly know (at the moment of HQL statement) which fields I'll use so there is no need for any extra db queries
Please note that I'm new to hibernate :-)