tags:

views:

179

answers:

1

I am using Hibernate as my ORM solution and have a need for a highly specialized object (for performance reasons) to be returned that is unlike my original object.

Is it valid to actually set up a second object with its own mapping file so I can set special join fetching and set batch sizes and so forth? Can 2 classes point back to the same table? Will this cause some strange results when trying to make an update on the original object?

Should I try and set parameters at run time for this fetch plan?

Maybe use a stored procedure to accomplish this?

This object structure is complex and involves traversing collections of collections and I am trying to eliminate the chattiness of the original object. I like the sound of option 1 since it would seem the easiest to configure and get going. Thanks!

+1  A: 

Could you give an example of what you're trying to do? There are lots of solutions to this problem.

Without knowing more, I'd probably say that by the sounds of it you're looking for custom ResultTranformers.

You can see an example of one being used for partial object queries here:

http://ayende.com/Blog/archive/2007/08/26/Partial-Object-Queries-With-NHibernate.aspx

jonnii
Thank you I will look into that further.
Brawndo