This is because AutoJoinedSubclass does not implement IJoinedSubclass.
I raised this wayback and submitted a patch, but it never got applied.
Until this is fixed you can't use conventions with AutoJoinedSubclass

-----Original Message-----
From: fluent-nhibernate@googlegroups.com 
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of oliver klemencic
Sent: 24 May 2009 20:41
To: Fluent NHibernate
Subject: [fluent-nhib] Re: AutoMap, Inheritance and Reference


As I said.. I currently don't understand all the code...

I took a look at
BaseMappingPartDiscoveryConvention<TPart>.ApplyConventions when it
gets called for the part which has the auto- joined- subclasses.
None of the conventions returned by
DefaultConventionFinder.Find<IMappingPartConvention>() handles the
auto-joined- subclass parts.

Maybe we need a convention which accepts AutoJoinedSubClass- parts and
applies all the default- convention for the sub- parts of the
AutoJoinedSubclass.


On May 23, 8:47 pm, Jon M <jgmerrifi...@googlemail.com> wrote:
> Oliver - were you able to write a custom convention or anything to get
> around it?
>
> On 23 May, 16:57, oliver klemencic <oliver.klemen...@gmail.com> wrote:
>
> > I have had the same problem and traced the error to the fact, that the
> > default conventions are not used for the AutoJoinedSubClass.
> > Until now I haven't fully understood the Fluent- Nhibernate source
> > code, so I could not fix this problem on my one.
>
> > On 23 Mai, 13:57, Jon M <jgmerrifi...@googlemail.com> wrote:
>
> > > Stuart, looks like the column name is missing for those properties:
>
> > >     <joined-subclass name="MyProj.Core.Domain.ImageAttachment,
> > > MyProj.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
> > >       <key column="JobAttachmentId" />
> > >       <property name="Description">
> > >         <column name="Description" />
> > >       </property>
> > >       <many-to-one name="Thumbnail" column="" />
> > >       <many-to-one name="FullSize" column="" />
> > >     </joined-subclass>
>
> > > What could cause them to be empty?
> > > Jon
>
> > > On 22 May, 15:45, Stuart Childs <chil...@gmail.com> wrote:
>
> > > > I've most often seen the "Index was outside the bounds of the array"
> > > > exception when column names were missing. Can you export your mappings 
> > > > with
> > > > a .ExportTo("path") and look through them or post them here?
>
> > > > On Fri, May 22, 2009 at 9:41 AM, Jon M <jgmerrifi...@googlemail.com> 
> > > > wrote:
>
> > > > > The message I get is as follows:
>
> > > > > FluentNHibernate.Cfg.FluentConfigurationException : An invalid or
> > > > > incomplete configuration was used while creating a SessionFactory.
> > > > > Check PotentialReasons collection, and InnerException for more detail.
>
> > > > >  ----> FluentNHibernate.Cfg.FluentConfigurationException : An invalid
> > > > > or incomplete configuration was used while creating a SessionFactory.
> > > > > Check PotentialReasons collection, and InnerException for more detail.
>
> > > > >  ----> NHibernate.MappingException : Could not compile the mapping
> > > > > document: (XmlDocument)
> > > > >  ----> System.IndexOutOfRangeException : Index was outside the bounds
> > > > > of the array.
>
> > > > > When I caught the exception in the debugger, the PotentialReasons
> > > > > collection was empty.
>
> > > > > Yes that ImageDate was a typo on my part, good catch!
> > > > > Jon
>
> > > > > On 22 May, 14:15, Paul Batum <paul.ba...@gmail.com> wrote:
> > > > > > What is the message for the exception? This is typically more 
> > > > > > useful than
> > > > > > the stack trace..
>
> > > > > > Also, Jon, is this part of your mapping correct?
>
> > > > > > public class ImageAttachment : JobAttachment
> > > > > > {
> > > > > >    public virtual string Description { get; set; }
> > > > > >    public virtual ImageData Thumbnail { get; set; }
> > > > > >    public virtual ImageDate FullSize { get; set; }
>
> > > > > > }
>
> > > > > > Or should the fullsize property be a ImageData rather than 
> > > > > > ImageDate?
>
> > > > > > On Thu, May 21, 2009 at 6:43 PM, Jon M <jgmerrifi...@googlemail.com>
> > > > > wrote:
>
> > > > > > > I'm getting the exact same problem.  My classes are similar:
>
> > > > > > > public class JobAttachment : Entity
> > > > > > > {
> > > > > > >    public virtual Job Job { get; set; }
> > > > > > >    public virtual DateTime CreatedDate { get; set; }
> > > > > > >    public virtual User CreatedBy { get; set; }
> > > > > > > }
>
> > > > > > > public class ImageAttachment : JobAttachment
> > > > > > > {
> > > > > > >    public virtual string Description { get; set; }
> > > > > > >    public virtual ImageData Thumbnail { get; set; }
> > > > > > >    public virtual ImageDate FullSize { get; set; }
> > > > > > > }
>
> > > > > > > public class ImageData : Entity
> > > > > > > {
> > > > > > >    public virtual string MimeType { get; set; }
> > > > > > >    public virtual byte[] Data { get; set; }
> > > > > > > }
>
> > > > > > > Setup code is more or less identical:
> > > > > > > sessionFactory = Fluently.Configure()
> > > > > > >    .Database(MsSqlConfiguration.MsSql2005.ConnectionString(x => 
> > > > > > > x.Is
> > > > > > > (connectionString)).ShowSql())
> > > > > > >    .Mappings(m =>
> > > > > > >    {
> > > > > > >        m.AutoMappings.Add(AutoPersistenceModel
> > > > > > >            .MapEntitiesFromAssemblyOf<Entity>()
> > > > > > >            .Where(x => typeof(Entity).IsAssignableFrom(x))
> > > > > > >            .WithSetup(x =>
> > > > > > >            {
> > > > > > >                x.IsBaseType = t => t == typeof(Entity);
> > > > > > >            }
> > > > > > >    })
> > > > > > >    .ExposeConfiguration(c => c.Properties.Add
> > > > > > > ("proxyfactory.factory_class",
> > > > > > > "NHibernate.ByteCode.Castle.ProxyFactoryFactory,
> > > > > > > NHibernate.ByteCode.Castle"))
> > > > > > >    .BuildSessionFactory();
>
> > > > > > > I updated from SVN last night (20th May).
>
> > > > > > > On May 18, 6:18 pm, Jose Selesan <jsele...@gmail.com> wrote:
> > > > > > > > Last week, on firday
>
> > > > > > > > On Mon, May 18, 2009 at 2:09 PM, James Gregory <
> > > > > jagregory....@gmail.com
> > > > > > > >wrote:
>
> > > > > > > > > When was the last time you did an update?
>
> > > > > > > > > On Mon, May 18, 2009 at 5:08 PM, Jose Selesan 
> > > > > > > > > <jsele...@gmail.com>
> > > > > > > wrote:
>
> > > > > > > > >> Hi people. I'm becoming crazy with a problem. I have classes 
> > > > > > > > >> like
> > > > > > > theese:
>
> > > > > > > > >> public class Entity
> > > > > > > > >> {
> > > > > > > > >>    public virtual int Id { get; protected set; }
> > > > > > > > >> }
>
> > > > > > > > >> public class Person: Entity
> > > > > > > > >> {
> > > > > > > > >>    public virtual string Name{ get; set; }
> > > > > > > > >> }
>
> > > > > > > > >> public class Foto: Entity
> > > > > > > > >> {
> > > > > > > > >>   public virtual DateTime DateTaken{ get; set; }
> > > > > > > > >> }
>
> > > > > > > > >> public class PersonFoto: Foto
> > > > > > > > >> {
> > > > > > > > >>    public virtual Person Person{ get; set; }
> > > > > > > > >> }
>
> > > > > > > > >> And I'm configuring my PersistenceModel like this:
>
> > > > > > > > >>             AutoPersistenceModel p = AutoPersistenceModel
> > > > > > > > >>                 .MapEntitiesFromAssemblyOf<Entity>()
> > > > > > > > >>                 .WithSetup(s =>
> > > > > > > > >>                 {
> > > > > > > > >>                     s.IsBaseType = i => i == typeof(Entity);
> > > > > > > > >>                 });
>
> > > > > Fluently.Configure().Database(MsSqlConfiguration.MsSql2005.ConnectionString
> > > > > > > (t
> > > > > > > > >> => t.Is("server=fsgestioner; uid=sa; pwd=sa; 
> > > > > > > > >> database=samples")))
> > > > > > > > >>                 .Mappings(
> > > > > > > > >>                     m => m.AutoMappings.Add(p)
> > > > > > > > >>                    ).BuildSessionFactory();
>
> > > > > > > > >> But when NHibernate is creating the session factory, It 
> > > > > > > > >> throws an
> > > > > > > > >> exception with this stack trace:
>
> > > > > > > > >>    en NHibernate.Mapping.Column.set_Name(String value)
> > > > > > > > >>    en 
> > > > > > > > >> NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindColumns(XmlNode
> > > > > > > node,
> > > > > > > > >> SimpleValue model, Boolean isNullable, Boolean autoColumn, 
> > > > > > > > >> String
> > > > > > > > >> propertyPath)
> > > > > > > > >>    en
> > > > > NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindManyToOne(XmlNode
> > > > > > > node,
> > > > > > > > >> ManyToOne model, String defaultColumnName, Boolean 
> > > > > > > > >> isNullable)
> > > > > > > > >>    en
> > > > > > > NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML(XmlNode
> > > > > > > > >> node, PersistentClass model)
> > > > > > > > >>    en
>
> > > > > NHibernate.Cfg.XmlHbmBinding.JoinedSubclassBinder.HandleJoinedSubclass(Pers
> > > > > > > istentClass
> > > > > > > > >> model, XmlNode subnode)
> > > > > > > > >>    en
> > > > > > > NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML(XmlNode
> > > > > > > > >> node, PersistentClass model)
> > > > > > > > >>    en 
> > > > > > > > >> NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode
> > > > > node,
> > > > > > > > >> HbmClass classSchema)
> > > > > > > > >>    en
>
> > > > > NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses(XmlNode
> > > > > > > > >> parentNode)
> > > > > > > > >>    en 
> > > > > > > > >> NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode
> > > > > > > node)
> > > > > > > > >>    en
> > > > > > > NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
> > > > > > > > >> doc)
>
> > > > > > > > >> The courious case is that I write my PersonFoto to this:
>
> > > > > > > > >> public class PersonFoto: Foto {
> > > > > > > > >>    public virtual string Person{get; set; }
> > > > > > > > >> }
>
> > > > > > > > >> It works!!!
> > > > > > > > >> Can anybody help me? I tried to override mappings, but 
> > > > > > > > >> without
> > > > > > > success.
>
> > > > > > > > >> Thanks in advance


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

Reply via email to