I don't think that this would be possible no.
On Mon, Mar 23, 2009 at 9:57 AM, Roy Razon <[email protected]> wrote:

> Hi,
>
> I have code which invalidates one record and inserts another similar one.
> Something like:
>
> oldPerson.IsValid = false;
> var newPerson = new Person() { Name = oldPerson.Name; IsValid = true };
>
> This is done under a single NHibernate transaction, in the "domain" (POCO)
> level which is unaware of NHibernate.
> I also have a unique key constraint defined on the Persons table with the
> columns Name and IsValid.
> When I commit the transaction (in the UI controller) I get a unique key
> violation exception, because NHibernate tries to INSERT the newPerson before
> it UPDATEs the oldPerson.
>
> Is there a way to configure NHibernate or instruct it in the UI controller
> level to do the SQL UPDATEs before the INSERTs?
> I know I can flush the session after the first line of code, but as I said
> this is done at a POCO level which is unaware of NHibernate.
>
> Thanks,
> Roy.
>
>
> >
>

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