2011/12/16 aric <[email protected]>: > Okay, I got it to work. The user field in the requestNote mapping is a > reserved word. Once i rename that field and it works. > > However, I had to do a requestService.Save first that way a requestID > will be generated and then I can pass it to the requestNote and save > it again.
Yes, If you ask NHibernate or lower layers to generate the ID you will have to Save() first. Note that Save() will ONLY do the insert sql if you use database generated identifiers. Otherwise the insert statement is deferred until later. On the other hand, one wonders why you use the requestId in the note, instead of referencing the request object directly. And also, you don't need to call Save() on the request again if the code you show is run in a single session. The regular dirty check will be enough. /Oskar -- 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.
