I do support when I can, but no development for NH Core :).And as fabio said
the problem is using identity strategy...

Gustavo.

On Fri, Jun 19, 2009 at 6:27 PM, nautic20 <[email protected]> wrote:

>
> Dear nhusers,
>
> First off thanks to Fabio and Gustavo for all your development and
> support efforts.  Life-saving work guys, hope one of you could help
> with this question.
>
> SETUP:
> I'm building an MVC web application using NHibernate 2.0.1.4000 as my
> business tier.  The app implements a UnitOfWork which wraps around an
> ISession.  The ISession itself is produced by an ISessionFactory
> (based of the ORMs of course) then stored to the HttpContext to be
> used globally throughout the application.  In each Repository Class, a
> Lambda expression is passed to a Find<>() method of the UnitOfWork
> (via its ISession field) in order to perform queries against the DB
> using session.Linq<>() (Love NHibernate.Linq, VERY AWESOME!).  In the
> ORMs, the id elements contain generator class="identity" and the PKs
> are Int32...  FlushMode = Never, unsaved-value="0".
>
>
> PROBLEM:
> When I want to build a transaction: I use the UnitOfWork to call
> BeginTransaction(), I create a transient instance of an object (new
> object) and populate its properties, I use the UnitOfWork to
> SaveOrUpdate() the newly created object to the current session. HUH?
> the session.SaveOrUpdate() actually performs a SQL Insert statement on
> the spot!  The session didn't even wait for me to call ISession.Flush
> ()!  WHY???
>
> The object I created depends on other objects (contains NOT NULLS)
> every time SaveOrUpdate() performs an INSERT on the incomplete object,
> the DB blows up the app...
>
>
> QUESTIONS:
> I didn't seem to have this problem in NHibernate 1.6, Is there
> something new added to 2.0?  What's the best design pattern to
> building an app in this fashion?
>
> Any replies would be greatly appreciated!
>
> >
>

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