Can I optimize these inserts?

0 views
Skip to first unread message

Niclas Pehrsson

unread,
May 12, 2009, 7:06:01 AM5/12/09
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?

Niclas Pehrsson

unread,
May 12, 2009, 7:11:37 AM5/12/09
to nhusers
Ouch just saw that it had been discussed just 2 threads below:
http://groups.google.se/group/nhusers/browse_thread/thread/d9e16b36eb93a6ce#

Sorry :|
Reply all
Reply to author
Forward
0 new messages