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
