Hi,

This is my mapping:

<class name="Parent" table="Parent">
  <id name="Id" ...><generator class="identity" /></id>
  <set name="Children">
    <key column="ParentID"/>
    <one-to-many class="Child"/>
    <loader query-ref="LoadChildren"/>
  </set>
</class>

<sql-query name="LoadChildren">
  <load-collection alias="child" role="Parent.Children"/>
    SELECT {child.*}
    FROM CHILD_TBL child
    WHERE ParentID = :ParentID
</sql-query>


When I read a parent object, I manually initialize the child
collection and everything works fine.
This is the initialization code:
...open session
session.Lock(parentObject, NHibernate.LockMode.None)
NHibernateUtil.Initialize(childCollectionObject)
...close session



I need to add a second parameter to the query loader:
WHERE ParentID = :ParentID AND OtherCondition = :Condition

Of course, when I execute the program, I have an exception: "Not all
named parameters have been set..."
How to resolve this problem?
Is there a way to replace the parameters before the call of
NHibernateUtil.Initialize?
Should I initialize the collection with a IQuery (I will replace
manually the parameters and I will use query.List) rather than the
NHibernateUtil.Initialize method?


Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to