Found the problem - a stray using statement was interfering with the
session in view management of the transaction.

On May 30, 6:53 pm, Sosh <[email protected]> wrote:
> Hi,
>
> I've been building an app with Native Ids initially, and am now
> switching to HiLos.
>
> However, I've come across a strange problem, and don't understand
> what's happening.
>
> With native ids everything is working fine.  However, if I one of the
> entity mappings to HiLo, new objects will not persist in the database
> (using SaveOrUpdate).  I don't receive any errors and no exception is
> thrown - everything acts like it's working, but no new db records.
>
> I'm just using default hilo settings.  I'm recreating the DB with
> SchemaUpdate/Export beforehand, and the Hibernate_Unique_Key table
> with the next_hi column is being created correctly.
>
> Here's the original mapping line that works:
>
> Id(c => c.Id).GeneratedBy.Native();
>
> And the one that breaks everything:
>
> Id(c => c.Id).GeneratedBy.HiLo("100");
>
> If I try to SaveOrUpdate() a new object, all I get in the sql logs is:
>
> 2010-05-28 18:15:09,703 DEBUG 4 NHibernate.SQL - Reading high
> value:select next_hi from hibernate_unique_key for update
> 2010-05-28 18:15:09,718 DEBUG 4 NHibernate.SQL - Updating high
> value:update hibernate_unique_key set next_hi = ?p0 where next_hi = ?
> p1;?p0 = 4, ?p1 = 3
>
> And in the nhibernate log:
>
> 2010-05-28 18:18:33,734 DEBUG 8 NHibernate.Impl.SessionImpl -
> [session-
> id=a948d92d-3edc-4f15-aa5a-3b7d461cb455] opened session at timestamp:
> 634106675137, for session factory: [/046fd6ce97f547aeb8a9edb8ddf6e2ef]
> 2010-05-28 18:18:33,734 DEBUG 8 NHibernate.Engine.IdentifierValue -
> unsaved-value: 0
> 2010-05-28 18:18:33,734 DEBUG 8
> NHibernate.Event.Default.AbstractSaveEventListener - transient
> instance of: xxxx.BusinessEvent
> 2010-05-28 18:18:33,734 DEBUG 8
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - saving
> transient instance
> 2010-05-28 18:18:33,734 DEBUG 8
> NHibernate.Event.Default.AbstractSaveEventListener - generated
> identifier: 304, using strategy: NHibernate.Id.TableHiLoGenerator
> 2010-05-28 18:18:33,734 DEBUG 8
> NHibernate.Event.Default.AbstractSaveEventListener - saving
> [xxxx.BusinessEvent#304]
> 2010-05-28 18:18:33,734 DEBUG 8 NHibernate.Impl.SessionImpl -
> [session-
> id=a948d92d-3edc-4f15-aa5a-3b7d461cb455] running ISession.Dispose()
> 2010-05-28 18:18:33,734 DEBUG 8 NHibernate.Impl.SessionImpl -
> [session-
> id=a948d92d-3edc-4f15-aa5a-3b7d461cb455] executing real Dispose(True)
> 2010-05-28 18:18:33,734 DEBUG 8 NHibernate.Impl.SessionImpl - closing
> session
> 2010-05-28 18:18:33,734 DEBUG 8 NHibernate.AdoNet.AbstractBatcher -
> running BatcherImpl.Dispose(true)
>
> Versions:
> Nhibernate 2.1.2.4000
> MySql5Dialect + MySql 5
>
> I'm pretty stumped - any ideas what the problem might be? Or what to
> check?
>
> Thanks

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