tags:

views:

39

answers:

0

I have an associated set of entities. And in mapping files I made them to be fetched by join. When a query is executed, the executed query and results seem allright. But when I tried to traverse the properties. Some of associated properties are being duplicated.

When I create my criteria I set the trasformer as "distinct root entity". Is there any solution to force nhibernate to make distinction on associated properties? It seems there is a mapping problem from sql results to entities. Or I am missing something when I create the query criterion.

the executed cri,teria looks like the code below.

ICriteria criteria = session.CreateCriteria<SurveyPage>()
                .Add(Expression.Eq("Survey.Id", surveyId))
                .SetResultTransformer(CriteriaUtil.DistinctRootEntity);

If needed I could post the relations between entities.(Yes, there are too many tables I need to post here!)