I've one object User which can have multiple Posts.
Example:
Load the user with lazy loading on the Posts IList<User> users = User.LoadAll()
Then I want to read only "half" of the users[2].Posts[3]
(retrieve only the attributes that I want and not all of them from that post object), is this possible to make?
(Note, I do not want to use a View).
Edit: Could someone give me a simple example code please? I tried to find one without success. Thanks
If I understand your question well - you want to get an object - Post in your case - but only some of it's properties - e.g. Post.Annotation and not Post.Content which both are strings.
This is NOT possible at the moment. Every object retrieved from database will have all its properties that are not relations nor collections loaded.
You can do a workaround:
by turning the biggish properties into a separate entity and then do many-to-one mapping and utilize lazy loading
by creating custom query be it HQL or criteria with projections (basically only few columns). This will however not return the full object.
Hope I got your question right...