mapping is for a one to many property. I've changed domainmodel naming for simplicity and a simpler Parent/child relation:
Code:
<class name="eg.Person, eg" table="person" mutable="false">
... id and other stuff left out for brevity
<bag name="children" inverse="true" lazy="true" cascade="all">
<key column="SubjectNr" />
<one-to-many class="eg.Child, eg" />
</bag>
</class>
Code:
<class name="eg.Child, eg" table="childs" mutable="false" >
<composite-id name="Identity" class="eg.childKey, eg" unsaved-value="none">
<key-many-to-one name="Parent" class="eg.Person, eg" column="SUBJECTNR" />
<key-property name="category" column="SOORT" />
.. other keys left out
</composite-id>
</class>
What I want is this (worked in 0.840):
session.Find("from eg.Person as person inner join fetch person.children as child where child.Identity.category= 170 " );
Explanation: I want to retrieve all parents and eagerly fetch the children, but only the children of category 170. (actually, that is a subtype so I would want to use something like child.class = xxx. That property is missing in nhibernate).
That gives the kind of errors in the previous post.
It does work though! ( i can click through the first-chance exceptions and it will produce the result I'm looking for).
I even get exceptions on the simplest of simplest query:
session.Find("from eg.Person as person inner join fetch person.Children" );
As you can see in the call stack below, it is trying to get to the class persoon.Inkomens (in my example: person.Children) and it's not resolving to the mapped class........
One of the exception call stacks:
Code:
nhibernate.dll!NHibernate.Impl.SessionFactoryImpl.GetPersister(string className = "persoon.Inkomens") + 0x6b bytes
nhibernate.dll!NHibernate.Hql.QueryTranslator.GetPersisterUsingImports(string className = "persoon.Inkomens") + 0x54 bytes
nhibernate.dll!NHibernate.Hql.FromParser.Token(string token = "persoon.Inkomens", NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x7f5 bytes
nhibernate.dll!NHibernate.Hql.ClauseParser.Token(string token = "persoon.Inkomens", NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x3e4 bytes
nhibernate.dll!NHibernate.Hql.PreprocessingParser.End(NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x27 bytes
nhibernate.dll!NHibernate.Hql.ParserHelper.Parse(NHibernate.Hql.IParser p = {NHibernate.Hql.PreprocessingParser}, string text = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", string seperators = " \n\r\f\t,()=<>&|+-=/*'^![]#~\\", NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x126 bytes
nhibernate.dll!NHibernate.Hql.QueryTranslator.Compile() + 0x77 bytes
nhibernate.dll!NHibernate.Hql.QueryTranslator.Compile(NHibernate.Engine.ISessionFactoryImplementor factory = {NHibernate.Impl.SessionFactoryImpl}, System.Collections.IDictionary replacements = {Count=0}, bool scalar = false) + 0x4d bytes
nhibernate.dll!NHibernate.Impl.SessionFactoryImpl.GetQuery(string queryString = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", bool shallow = false) + 0xe9 bytes
nhibernate.dll!NHibernate.Impl.SessionImpl.GetQueries(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", bool scalar = false) + 0x3a bytes
nhibernate.dll!NHibernate.Impl.SessionImpl.Find(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", NHibernate.Engine.QueryParameters parameters = {NHibernate.Engine.QueryParameters}) + 0xc3 bytes
nhibernate.dll!NHibernate.Impl.SessionImpl.Find(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", System.Object[] values = {Length=0}, NHibernate.Type.IType[] types = {Length=0}) + 0x36 bytes
nhibernate.dll!NHibernate.Impl.SessionImpl.Find(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens") + 0x27 bytes
> batch.dll!Batch.VerwerkenBestandHeffingskorting.Start() Line 28 + 0x16 bytes C#