I have a stored procedure i would like to run to popoulate my entity.
IQuery iq = session.CreateSQLQuery("exec myStoredProcedure") .AddEntity("s", typeof(Shop)) .AddJoin("t", "s.Types");
var test = iq.List<Shop>();
I have written this stored procedure to get around an N+1 problem with Paging.
Shop has a Many to Many relationship with Type.
If i remove the AddJoin and select shop.* from my stored procedure, then my shop entity loads up, but obviouly doesnt eager load the types.
I think i need to use the AddJoin method to eager load my types but cant seem to get it right.
I selected ----- shop.*, shopTypes.*, types.* ----- shop.*, types.*
but nothing seems to work.
I have even written the hql for this, and then added the selection columns from this, but still it doesnt work.
Any ideas???
|