inverse="true"

On Jun 9, 3:04 pm, Suggy75 <[email protected]> wrote:
> Here is the scenario
>
> I have a Customer object and a Note object. My Customer has collection
> of Notes, along with a method to add a new note to a customer.
>
> ..and here is the mapping on my Customer object. As you can see I have
> a link table (Oracle database BTW)
>
>     <bag name="Notes" table="CUSTOMER_NOTES_MAPPING" lazy="true" batch-
> size="20" cascade="save-update">
>       <key column="ACCOUNT_NUMBER"></key>
>       <many-to-many class="Note" column="NOTE_ID"></many-to-many>
>     </bag>
>
> So when I save my Customer object with a new Note added, NHibernate
> generates 2 insert statements, 1 for the notes table and one for the
> link table. All pretty standard stuff.
>
> Now onto the challenge I face.
>
> I run some batch processing against my Customer objects (actually a
> 'CustomerBatch' object with specific mappings for batch processing).
>
> At certain points during the processing, I add notes to the customer
> so the front end users can see what the batch process has done. In
> this scenario, I don't need / want to retrieve the Notes collection,
> all I want to do is add to it. Obviously, as soon as my AddNote(...)
> method references the Notes property to add a new item, the entire
> collection is loaded from the database.
>
> As my notes table is growing, the performance of my batch process is
> slowing as it's retrieving large numbers of objects it doesn't need.
>
> Now the question.
>
> Is it possible to map a 'write only collection' for want of a better
> phrase? So when I add a note to my customer, it never retrieves the
> saved collection, only adds to it?
>
> I've thought about directly persisting the Note object and somehow at
> the same time insert into the link table also, but I can't help
> thinking there could be a simple mapping which would overcome by
> initial challenge.

-- 
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