My real question is another... btw, the Save is the method who can delay the
insert.
Obviously if you use HiLo, Guid, Guid.conb, guid.native, sequence nobody
will insert the record before flush the session.

On Tue, Apr 27, 2010 at 11:56 AM, Brian Pritchard <[email protected]
> wrote:

> Hi Fabio,
>
> What I'm trying to get at is there is a needed feature of allowing
> transient entities to be associated with the session without going to
> the db imediatly when using generated id's.
>
> You say that the semantics of persist should ensure id's are
> available, but then why do we need it when there is save.
>
> The nh recomended way is to use hilo or guids so in those cases id's
> will be available anyway.  But for those with legacy db's I think it
> is understandable that id's aren't there until you flush, if you can
> keep the inserts from going early you would make a lot of people
> happy.
>
> On Apr 27, 9:42 am, Fabio Maulo <[email protected]> wrote:
> > Save mean Save in the UoW.
> > Persist is clear enough.
> >
> > On Tue, Apr 27, 2010 at 9:45 AM, Brian Pritchard
> > <[email protected]>wrote:
> >
> >
> >
> >
> >
> > > Maybe Persist is bad name for it as it does imply the same thing as
> > > Save.
> >
> > > Still, those using db generated id's need a way to delay inserts until
> > > flush.
> >
> > > What if there were a method named Associate or Attach?
> >
> > > On Apr 26, 11:59 pm, Fabio Maulo <[email protected]> wrote:
> > > > even if I think it work in the same way using session.Save, the
> semantic
> > > of
> > > > session.Persist should include the immediate availability of ID.
> >
> > > > On Mon, Apr 26, 2010 at 9:03 PM, Brian Pritchard
> > > > <[email protected]>wrote:
> >
> > > > > Hi, first like to say that I'm brand new to NHibernate and so far
> it's
> > > > > wonderful!
> >
> > > > > I'm working with a legacy oracle database that is using trigger
> auto-
> > > > > increment id's.  The TriggerIdentityGenerator works great but the
> > > > > problem is calling session.Persist() causes inserts to go the db
> > > > > immediately instead of during flush.
> >
> > > > > Looking through the code I found in the AbstractSaveEventListener
> > > > > class in PerformSaveOrReplicate a boolean
> shouldDelayIdentityInserts,
> > > > > that at one point (revision 3005 in case it helps) would allow the
> > > > > insert to be delayed.
> >
> > > > > // NH Different behavior (shouldDelayIdentityInserts=false anyway)
> > > > > //bool inTxn = source.ConnectionManager.IsInActiveTransaction;
> > > > > //bool shouldDelayIdentityInserts = !inTxn && !
> > > > > requiresImmediateIdAccess;
> > > > > bool shouldDelayIdentityInserts = false;
> >
> > > > > I changed in my local build to allow this and everything seems to
> work
> > > > > as I had hoped and without issue.  Although I'm still trying to
> figure
> > > > > out how to get the unit tests to run so I don't know if this breaks
> > > > > any tests.
> >
> > > > > Is there any reason this couldn't be reverted back?
> >
> > > > > Thanks,
> > > > > Brian Pritchard
> >
> > > > > --
> > > > > Subscription settings:
> > > > >
> http://groups.google.com/group/nhibernate-development/subscribe?hl=en
> >
> > > > --
> > > > Fabio Maulo
> >
> > --
> > Fabio Maulo
>



-- 
Fabio Maulo

Reply via email to