I been scratching my head on this one for awhile.. any help would be
appreciated.
I have two tables (request and requestNotes) i am saving a request
first then once i have the RequestID from the request then I save the
notes into the requetNotes table and pass over the requestID but i
can't get the notes to save.
Here is my Mapping
<class name="CUS_SCU_Request" table="CUS_SCU_Request">
<id name="RequestID" column="RequestID" type="int">
<generator class="identity" />
</id>
<property name="QueueInstanceID" type="Guid" not-null="true" />
<property name="RequestDate" type="DateTime" not-null="true" />
<many-to-one cascade="none"
class="Jenzabar.Portal.Framework.NHibernateFWK.Couplers.PortalUserCoupler,
Jenzabar.Portal.Framework"
name="SubmittedUser"
column="RequestBy"
not-null="true"></many-to-one>
<property name="AssignTo" type="Guid" not-null="false" />
<property name="Subject" type="String" not-null="true" />
<bag name="Notes" table="CUS_SCU_RequestNotes" cascade="all">
<key column="RequestID" />
<one-to-many class="RequestNote" />
</bag>
</class>
<class name="RequestNote" table="CUS_SCU_RequestNotes">
<id name="NoteID" column="RequestNoteID" type="int">
<generator class="identity" />
</id>
<property name="RequestID" column="RequestID" type="int" />
<property name="DateEntered" column="DateTime" type="DateTime" not-
null="false" />
<many-to-one cascade="none"
class="Jenzabar.Portal.Framework.NHibernateFWK.Couplers.PortalUserCoupler,
Jenzabar.Portal.Framework"
name="User"
column="User"
not-null="true"></many-to-one>
<property name="Notes" column="Notes" type="String" not-
null="false" />
<property name="StatusID" column="StatusID" type="int" not-
null="false" />
</class>
Inserting a REQUEST
RequestMapperService requestService = new
RequestMapperService();
CUS_SCU_Request request = new CUS_SCU_Request();
request.QueueInstanceID = QIID;
request.RequestDate = DateTime.Now;
request.SubmittedUser = new
PortalUserCoupler(PortalUser.Current);
request.Subject = txtSubject.Text;
requestService.Save(request);
Inserting a NOTE
RequestNote note = new RequestNote();
note.RequestID = request.RequestID;
note.DateEntered = DateTime.Now;
note.User = new PortalUserCoupler(PortalUser.Current);
note.Notes = txtDescription.Text;
note.StatusID = 1;
request.Notes.Add(note);
requestService.Save(request);
--
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.