I have problem with selecting objects from database with one-to-many
relations.
Database scheme is like this :
Company CompanyTranslations
________ _________________
CompanyId ID
.... CompanyId
CompanyName
Locale
When I create criteria I use Create alias with LeftOuterJoin and
additional join parameter for locale
var query = var query = Session.CreateCriteria<Company>("company")
.Add(Restrictions.Eq("IsActive", true));
query.CreateAlias("Translations", "translationsF",
JoinType.LeftOuterJoin, Restrictions.Eq("Locale", "en").IgnoreCase());
After that I have detached criteria for order by table fields like CompanyName
and pagination.
Selection works correct but after that when I want to get translation from
property they contain empty or on element which locale matches with alias
restriction.
In mapping for Translation property I tried to use
HasMany<CompanyTranslation>(Reveal.Member<Company>("Translations")).KeyColumn("CompanyId").Cascade.All().Fetch.Subselect()/Join();
But it doesn't get any results.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.