Nhibernate producing proxy despite HQL fetch

95 views
Skip to first unread message

StuS

unread,
Apr 17, 2012, 11:24:40 AM4/17/12
to nhu...@googlegroups.com

 I have the following HQL statement:

select distinct t from TaskEntity as 
inner join fetch t
.Case as c
inner join fetch c
.Client as client
inner join fetch c
.Matter as matter

However, despite Matter having a FETCH against it, it's still returning as a proxy.

My mapping for this object is below

References(x => x.Matter).Columns(new[] {"c_client","c_matter" });

I read about in various places, that this is due to a composite key, but I never found any solutions - any ideas?

Any thoughts?

Thanks,

Anne Epstein

unread,
Apr 17, 2012, 12:40:46 PM4/17/12
to nhu...@googlegroups.com
Stu, take a look here:
specifically, the "ID Object" section - that section is talking identifiers in regards to caching, but I suspect you are hitting the same issue in a slightly different way. 



--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/bQ1J8KWlj28J.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

StuS

unread,
Apr 18, 2012, 4:37:29 AM4/18/12
to nhu...@googlegroups.com
Anne,

Thanks for the post - It was due to my own abstractions that things broke!

I thought it would be easier to use a BaseCompositeEntity class to do the overriding over the equals and HashCode for us (Looking back this was a bit stupid).

So I was overriding only to use the base.Equals (thus putting things back were they were!)

Overriding the Equals and GetHashCode methods properly corrected the issue!

Thanks for this!
To unsubscribe from this group, send email to nhusers+unsubscribe@googlegroups.com.

StuS

unread,
Apr 18, 2012, 4:44:50 AM4/18/12
to nhu...@googlegroups.com
I've also answered this here:

http://stackoverflow.com/questions/10176862/nhibernate-producing-proxy-despite-hql-fetch/10205863#10205863 

And linked you on the posting


On Tuesday, April 17, 2012 5:40:46 PM UTC+1, aje...@gmail.com wrote:
To unsubscribe from this group, send email to nhusers+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages