So, you're saying that you explicitly set Id property to some value x, but
after the Save method is called Id has value 0 in it?
That's odd.


2014-04-07 15:10 GMT+04:00 Duncan Bradley <duncan.brad...@gmail.com>:

> Thanks for your replies.
>
> I have reverted to v1.2.0.712 and the problem is not there. Upgrading to
> 1.3.0.717 and the problem occurs. So it looks like there was a change
> between 1.2 & 1.3 that makes the problem appear.
>
> The tests initialise a nHibernate session:
>
>  var config = Fluently.Configure()
>
>                 .Database(
>                 SQLiteConfiguration.Standard.ConnectionString(
>             x => x.Is(mConnectionString)).Driver<SqliteDriver>().ShowSql());
>
>     foreach (var assembly in assembliesWithMappings)
>     {
>
>    config.Mappings(                m =>                {
>                   m.FluentMappings.AddFromAssembly(assembly);
>                   m.FluentMappings.Conventions.AddAssembly(assembly);
>                 }            );            }       }
>
>       var configuration = config.BuildConfiguration();
>
>       BuildSchema(configuration);
>      mFactory = configuration.BuildSessionFactory();
> // Get the session     mSession = mFactory.OpenSession(GetConnection());
>
>
> Then as part of the tests, it creates two persistence objects with slightly 
> different data and saves:
>
> DataPartition mDataPartition = DataPartitionTestObject.ValidDataPartition();
> DataPartition mAnotherDataPartition = 
> DataPartitionTestObject.ValidDataPartitionAlt();
>
>  mDataPartitionRepository.Save(mDataPartition);
>  mDataPartitionRepository.Save(mAnotherDataPartition); <== error
>
> SetUp : NHibernate.NonUniqueObjectException : a different object with the 
> same identifier value was already associated with the session: 0, of entity: 
> Select.Domain.Persistence.DataPartition
>    at NHibernate.Engine.StatefulPersistenceContext.CheckUniqueness(EntityKey 
> key, Object obj)
>    at 
> NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object
>  entity, EntityKey key, IEntityPersister persister, Boolean 
> useIdentityColumn, Object anything, IEventSource source, Boolean 
> requiresImmediateIdAccess)
>    at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object 
> entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, 
> Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
>    at 
> NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object 
> entity, String entityName, Object anything, IEventSource source, Boolean 
> requiresImmediateIdAccess)
>    at 
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent
>  event)
>    at 
> NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent
>  event)
>    at 
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent
>  event)
>    at 
> NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent
>  event)
>    at 
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent
>  event)
>    at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
>    at NHibernate.Impl.SessionImpl.Save(Object obj)
>
> When you look at the first object, the ID is set to 0, and so is the
> second. My test code can put an id into the object but it is reset to 0 on
> save.
>
>
>
> On 5 April 2014 11:36, Gleb Chermennov <thebitteren...@gmail.com> wrote:
>
>> Can you do me a favor and try previous version of Fluent - 1.3.0.733 I
>> think on Nuget - and tell me if the problem still there? That way I can
>> pinpoint whether it's something we changed in 1.4 or it's an old bug. Thanks
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Fluent NHibernate" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/fluent-nhibernate/vetRx7HF_gY/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> fluent-nhibernate+unsubscr...@googlegroups.com.
>> To post to this group, send email to fluent-nhibernate@googlegroups.com.
>> Visit this group at http://groups.google.com/group/fluent-nhibernate.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Fluent NHibernate" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/fluent-nhibernate/vetRx7HF_gY/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> fluent-nhibernate+unsubscr...@googlegroups.com.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> Visit this group at http://groups.google.com/group/fluent-nhibernate.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
С уважением,
Чермённов Глеб,
тел. (916) 314-9324

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to