Nevermind..... the problem was in the way that Fluent NHibernate's
PersistenceSpecification test was interacting with the entity. Not
sure what the bug is, but when I save the entity by directly calling
session.Save, it works fine.

On Feb 18, 6:56 pm, JohnRudolfLewis <johnrle...@gmail.com> wrote:
> In my entity class I have the following property:
>
>    public virtual IList<string> Tags { get; private set; }
>
> In my fluent nhibernate mapping file, I have the following mapping:
>
>   HasMany(x => x.Tags)
>                 .Table("ProductTags")
>                 .Element("Tag")
>                 .AsBag();
>
> Which results in the following hbm mapping
>
>    <bag name="Tags" table="ProductTags">
>       <key>
>         <column name="Product_id" />
>       </key>
>       <element type="System.String, mscorlib, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089">
>         <column name="Tag" />
>       </element>
>     </bag>
>
> I am able to build a session factory, but when I try to save an
> entity, I get the following exception:
>
> NHibernate.MappingException :Nopersisterfor: System.String
> at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String
> entityName)
> at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName,
> Object obj)
> at
> NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Obje­ct
> entity, String entityName, Object anything, IEventSource source,
> Boolean requiresImmediateIdAccess)
> at
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGenerated­OrRequestedId(SaveOrUpdateEvent
> event)
> at
> NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrReques­tedId(SaveOrUpdateEvent
> event)
> at
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient­(SaveOrUpdateEvent
> event)
> at
> NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveO­rUpdateEvent
> event)
> at
> NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(Sa­veOrUpdateEvent
> event)
> at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
> at NHibernate.Impl.SessionImpl.Save(Object obj)
> at
> FluentNHibernate.Testing.PersistenceSpecification`1.TransactionalSave(Objec­t
> propertyValue) in d:\Builds\FluentNH\src\FluentNHibernate\Testing
> \PersistenceSpecification.cs: line 135
> at
> FluentNHibernate.Testing.PersistenceSpecification`1.CheckList(Expression`1
> expression, IList`1 propertyValue) in d:\Builds\FluentNH\src
> \FluentNHibernate\Testing\PersistenceSpecification.cs: line 74
> at
> AspZone.Commerce.CoreTests.Infrastructure.Persistence.Mappings.ProductTest.­CanPersistProduct()
> in ProductTest.cs: line 23

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhus...@googlegroups.com.
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to