Can we see how you're setting your conventions and where you're plumbing FNH
into NHibernate?

On Tue, Feb 10, 2009 at 12:01 PM, Jimit <[email protected]> wrote:

>
> I get the following error when attempting to test my mappings:
>
> <?xml version="1.0" encoding="utf-8"?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
> lazy="true" assembly="Core.Common" namespace="Core.Common.Entities">
>  <class name="DomainObject" table="`DomainObject`"
> xmlns="urn:nhibernate-mapping-2.2">
>    <cache usage="read-write" />
>    <version access="nosetter.pascalcase-underscore" column="Version"
> name="Version" />
>  </class>
> </hibernate-mapping>
>
> System.Xml.Schema.XmlSchemaValidationException: The element 'class' in
> namespace 'urn:nhibernate-mapping-2.2' has invalid child element
> 'version' in namespace 'urn:nhibernate-mapping-2.2'. List of possible
> elements expected: 'id, composite-id' in namespace 'urn:nhibernate-
> mapping-2.2'.
> -- Exception doesn't have a stack trace --
> NHibernate.MappingException: (XmlDocument)(5,6): XML validation error:
> The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has
> invalid child element 'version' in namespace 'urn:nhibernate-
> mapping-2.2'. List of possible elements expected: 'id, composite-id'
> in namespace 'urn:nhibernate-mapping-2.2'.
> at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
> at NHibernate.Cfg.Configuration.ValidationHandler(Object o,
> ValidationEventArgs args)
> at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent
> (ValidationEventHandler eventHandler, Object sender,
> XmlSchemaValidationException e, XmlSeverityType severity)
> at System.Xml.Schema.XmlSchemaValidator.ElementValidationError
> (XmlQualifiedName name, ValidationState context,
> ValidationEventHandler eventHandler, Object sender, String sourceUri,
> Int32 lineNo, Int32 linePos, Boolean getParticles)
> at System.Xml.Schema.XmlSchemaValidator.ValidateElementContext
> (XmlQualifiedName elementName, ref Boolean invalidElementInContext)
> at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String
> localName, String namespaceUri, XmlSchemaInfo schemaInfo, String
> xsiType, String xsiNil, String xsiSchemaLocation, String
> xsiNoNamespaceSchemaLocation)
> at System.Xml.XsdValidatingReader.ProcessElementEvent()
> at System.Xml.XsdValidatingReader.ProcessReaderEvent()
> at System.Xml.XsdValidatingReader.Read()
> at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
> at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
> at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
> Boolean preserveWhitespace)
> at System.Xml.XmlDocument.Load(XmlReader reader)
> at NHibernate.Cfg.Configuration.LoadMappingDocument(XmlReader
> hbmReader, String name)
> 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.MappingVisitor.AddMappingDocument(XmlDocument
> document, Type type)
> at FluentNHibernate.Mapping.ClassMap`1.ApplyMappings(IMappingVisitor
> visitor)
> System.ApplicationException: Error while trying to build the Mapping
> Document for 'Core.Common.Entities.DomainObject'
> at FluentNHibernate.Mapping.ClassMap`1.ApplyMappings(IMappingVisitor
> visitor)
> at FluentNHibernate.PersistenceModel.<>c__DisplayClass1.<Configure>b__0
> (IMapping mapping)
> at System.Collections.Generic.List`1.ForEach(Action`1 action)
> at FluentNHibernate.PersistenceModel.Configure(Configuration
> configuration)
> at FluentNHibernate.AutoMap.AutoPersistenceModel.Configure
> (Configuration configuration)
> at FluentNHibernate.Cfg.AutoMappingsContainer.Apply(Configuration cfg)
> at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
> at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
> FluentNHibernate.Cfg.FluentConfigurationException: An invalid or
> incomplete configuration was used while creating a SessionFactory.
> Check PotentialReasons collection, and InnerException for more detail.
>
>
> at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
> at Core.Infrastructure.Data.NHibernate.Tests.PersistenceTests.SetUp()
> in PersistenceTests.cs: line 21
>
> DomainObject is marked as a base class in Conventions.IsBaseClass so
> I'm not sure why it's even creating a mapping for it. Essentially it
> contains some common functionality for both entities and value objects
> in my domain. I'm ignoring almost all it's properties in the mapping
> override except for the Version property which I've mapped as readonly
> with access through a Pascal-case field prefixed with underscore.
> The xml schema validation seems to be expecting an Id mapping as the
> first child to <class> but DomainObject doesn't have one.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to