Confirming the issue has been resolved with r531.
ty.
On May 26, 9:47 pm, James Gregory <jagregory....@gmail.com> wrote:
> I've just committed a fix for this, let me know if there's any further
> issues with it.
>
> On Tue, May 26, 2009 at 9:00 AM, James Gregory <jagregory....@gmail.com>wrote:
>
> > I think we've just found what this problem is in another thread, it's
> > because conventions aren't being applied to automapped subclasses (and the
> > conventions are responsible for setting the column names). I should
> > hopefully get a fix in for this tonight.
>
> > On Tue, May 26, 2009 at 8:53 AM, Darko Konrad <lestat1...@gmail.com>wrote:
>
> >> Hi guys,
>
> >> I am having exactly the same issue like described above with the
> >> revision r523 fromhttp://fluentnhibernate.org/downloads
> >> James: Can you please advise where to find the fixed version of the
> >> library which resolves this issue?
>
> >> Thanks a lot. Great project!
>
> >> On 5 Mai, 23:21, James Gregory <jagregory....@gmail.com> wrote:
> >> > Ricardo: that exception looks very familiar. I committed a fix earlier
> >> today
> >> > that certainly fixed an exception very similar to that, if I were you
> >> I'd do
> >> > an update and double check it isn't already fixed.
>
> >> > On Tue, May 5, 2009 at 7:23 PM, Ricardo <cub...@gmail.com> wrote:
>
> >> > > I believe I am having this same issue. I will post all my info,
> >> > > hoping to help. I'm going to try Kevin's fix for now to see if it
> >> > > works, and if I have time, I'll also attempt to help.
>
> >> > > I have a Poll that has a list of Answers. If I leave it at that, it
> >> > > works fine. But as soon as I add a many-to-one of an Answer has one
> >> > > Poll, it gives me the error that's at the bottom of this.
>
> >> > > If you need anymore info, let me know. Thanks in advance.
>
> >> > > I see the problem, and it looks to be the same as Kevin's. Namely,
> >> > > the mapping on answer has this: <many-to-one name="Poll" column="" />
> >> > > hbm.xml:
> >> > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
> >> > > access="">
> >> > > <class name="OCS.Data.Entities.BaseEntity, OCS.Data,
> >> > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
> >> > > table="`BaseEntity`" xmlns="urn:nhibernate-mapping-2.2">
> >> > > <id name="Id" type="Int32" column="Id">
> >> > > <generator class="identity" />
> >> > > </id>
> >> > > <joined-subclass name="OCS.Data.Entities.Poll, OCS.Data,
> >> > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
> >> > > <key column="BaseEntityId" />
> >> > > <property name="Question">
> >> > > <column name="Question" />
> >> > > </property>
> >> > > <bag name="Answers">
> >> > > <key />
> >> > > <one-to-many class="OCS.Data.Entities.Answer, OCS.Data,
> >> > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
> >> > > </bag>
> >> > > </joined-subclass>
> >> > > <joined-subclass name="OCS.Data.Entities.Answer, OCS.Data,
> >> > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
> >> > > <key column="BaseEntityId" />
> >> > > <property name="Text">
> >> > > <column name="Text" />
> >> > > </property>
> >> > > <property name="Value">
> >> > > <column name="Value" />
> >> > > </property>
> >> > > <many-to-one name="Poll" column="" />
> >> > > </joined-subclass>
> >> > > </class>
> >> > > </hibernate-mapping>
> >> > > Config:
> >> > > Type sessionContextType = typeof
> >> (Test);
> >> > > string contextClass =
> >> > > Configuration.GetConfigSetting
> >> > > ("current_session_context_class",
> >> > > sessionContextType.AssemblyQualifiedName);
> >> > > return Fluently.Configure()
>
> >> > > .Database(MsSqlConfiguration.MsSql2005
> >> > > .ConnectionString(c =>
> >> c.
>
> >> > > FromConnectionStringWithKey("OCSDB")))
> >> > > .Mappings(m =>
> >> > > m.AutoMappings.Add(
>
> >> > > AutoPersistenceModel.MapEntitiesFromAssemblyOf<Answer>
> >> > > ()
>
> >> > > .Where(t => t.Namespace == "OCS.Data.Entities")
> >> > > )
>
> >> > > .ExportTo(@"c:\logs"))
> >> > > .ExposeConfiguration(c =>
> >> > > {
>
> >> > > c.SetProperty
> >> > > ("current_session_context_class", contextClass);
>
> >> var
> >> > > export = new SchemaExport(c);
>
> >> > > export.Drop(false, true);
>
> >> > > export.Create(false, true);
> >> > > })
> >> > > .BuildSessionFactory();
>
> >> > > Test:
> >> > > [TestFixture]
> >> > > public class VoteTests : BaseTestFixture
> >> > > {
> >> > > [Test]
> >> > > public void GetVoteTotalsForAnswer()
> >> > > {
> >> > > BeginTransaction();
>
> >> > > try
> >> > > {
> >> > > var poll = new Poll();
> >> > > var answer = new Answer("love", poll);
> >> > > poll.Answers.Add(answer);
> >> > > answer.Vote();
>
> >> > > FlushSession();
>
> >> > > var actualPoll =
> >> PollManager.Get(poll.Id);
>
> >> > > Expect(actualPoll.Answers.Where(a =>
> >> a.Value
> >> > > == "love").First
> >> > > ().GetTotalVotes(), Is.EqualTo(1));
> >> > > }
> >> > > finally
> >> > > {
> >> > > Rollback();
> >> > > }
> >> > > }
> >> > > }
>
> >> > > BaseEntity:
> >> > > public class BaseEntity
> >> > > {
> >> > > public virtual int Id { get; set; }
> >> > > }
> >> > > Poll:
> >> > > public class Poll : BaseEntity
> >> > > {
> >> > > public Poll()
> >> > > {
> >> > > Answers = new List<Answer>();
> >> > > }
>
> >> > > public virtual IList<Answer> Answers { get; set; }
>
> >> > > public virtual string Question { get; set; }
> >> > > }
>
> >> > > Answer:
> >> > > public class Answer : BaseEntity
> >> > > {
> >> > > public Answer(string value, Poll poll)
> >> > > {
> >> > > Value = value;
> >> > > Poll = poll;
> >> > > }
>
> >> > > public Answer() {}
>
> >> > > public virtual string Text { get; set; }
> >> > > public virtual string Value { get; set; }
>
> >> > > internal virtual int Votes { get; set; }
>
> >> > > public virtual Poll Poll { get; set; }
>
> >> > > public override string ToString()
> >> > > {
> >> > > return Text;
> >> > > }
> >> > > }
>
> >> > > Error:
> >> > > VoteTests.GetVoteTotalsForAnswer : Failed
> >> > > key
> >> > > property
> >> > > bag
> >> > > key
> >> > > property
> >> > > property
> >> > > many-to-one
> >> > > id
> >> > > joined-subclass
> >> > > joined-subclass
> >> > > key
> >> > > property
> >> > > bag
> >> > > key
> >> > > property
> >> > > property
> >> > > many-to-one
> >> > > id
> >> > > joined-subclass
> >> > > joined-subclass
>
> >> > > System.IndexOutOfRangeException: Index was outside the bounds of the
> >> > > array.
> >> > > at NHibernate.Mapping.Column.set_Name(String value)
> >> > > at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindColumns(XmlNode node,
> >> > > SimpleValue model, Boolean isNullable, Boolean autoColumn, String
> >> > > propertyPath)
> >> > > at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindManyToOne(XmlNode
> >> > > node, ManyToOne model, String defaultColumnName, Boolean isNullable)
> >> > > at NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML(XmlNode
> >> > > node, PersistentClass model)
> >> > > at
> >> > > NHibernate.Cfg.XmlHbmBinding.JoinedSubclassBinder.HandleJoinedSubclass
> >> > > (PersistentClass model, XmlNode subnode)
> >> > > at NHibernate.Cfg.XmlHbmBinding.ClassBinder.PropertiesFromXML(XmlNode
> >> > > node, PersistentClass model)
> >> > > at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode node,
> >> > > HbmClass classSchema)
> >> > > at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses
> >> > > (XmlNode parentNode)
> >> > > at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode node)
> >> > > at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
> >> > > doc)
> >> > > NHibernate.MappingException: Could not compile the mapping document:
> >> > > (XmlDocument)
> >> > > at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
> >> > > at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
> >> > > doc)
> >> > > at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
> >> > > at NHibernate.Cfg.Configuration.AddDocumentThroughQueue
> >> > > (NamedXmlDocument document)
> >> > > at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader,
> >> > > String name)
> >> > > at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream,
> >> > > String name)
> >> > > at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc, String
> >> > > name)
> >> > > at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc)
> >> > > at FluentNHibernate.PersistenceModel.Configure(Configuration cfg) in
> >> > > PersistenceModel.cs: line 211
> >> > > at FluentNHibernate.AutoMap.AutoPersistenceModel.Configure
> >> > > (Configuration configuration) in AutoPersistenceModel.cs: line 131
> >> > > at
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---