Niclas Pehrsson
unread,May 12, 2009, 7:06:01 AM5/12/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nhusers
Hi I have a question about collections and insert optimizations.
In my case I have a an entity Receipt, and it has one to many
receiptrows.
NH Profiler gives me this information about which sql queries being
executed:
INSERT INTO Receipt
(Id)
VALUES ('887c9d7c-5030-4058-840f-57f1f681a732' /* @p0 */)
INSERT INTO ReceiptEntry
(Id)
VALUES ('f4c3c8a7-924b-4364-8a8c-64fa366e8847' /* @p0 */)
UPDATE ReceiptEntry
SET ReceiptId = '887c9d7c-5030-4058-840f-57f1f681a732' /* @p0 */
WHERE Id = 'f4c3c8a7-924b-4364-8a8c-64fa366e8847' /* @p1 */
My problem is I don't want he Update query, I want it to be merged
with the Insert of ReceiptEntry, how can I manage that.
Here are my mappings in Receipt, ReceiptEntry does not know about its
owner.
<set name="Entries" access="field.camelcase-underscore"
inverse="false" cascade="all">
<key column="ReceiptId" foreign-key="FK_ReceiptEntry_Receipt" on-
delete="cascade"/>
<one-to-many class="CashRegister.ReceiptEntry, CashRegister"/>
</set>
Can I solve this?