-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: The element 'class' has invalid child element 'property'...
PostPosted: Sat Feb 03, 2007 1:14 pm 
Newbie

Joined: Sat Feb 03, 2007 12:57 pm
Posts: 2
Hibernate version: 1.0.3.0

Mapping documents:
The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.0'. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:jcs-cache urn:nhibernate-mapping-2.0:cache urn:nhibernate-mapping-2.0:id urn:nhibernate-mapping-2.0:composite-id'.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   <class name="GS.Catalog.Category,GS.Catalog" table="gsc_Category" lazy="true">

      <id name="Id" column="id" type="String">
         <generator class="assigned"/>
      </id>
      <property column="visible" type="Boolean" name="Visible" not-null="true" />
      <property column="title" type="String" name="Title" length="256" />
      <property column="description" type="String" name="Description" length="2048" />
      <property column="imageUrl" type="String" name="ImageUrl" length="256" />
      <property column="imageAltText" type="String" name="ImageAltText" length="256" />
      <property column="parentCategoryId" type="String" name="ParentCategoryId" length="32" />
      <property column="displayOrder" type="Int32" name="DisplayOrder" />
      
   </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

public static ISession GetCurrentSession()
Code:
       {
            HttpContext context = HttpContext.Current;
            ISession currentSession = context.Items[CurrentSessionKey] as ISession;
            if (currentSession == null)
            {
                currentSession = sessionFactory.OpenSession();
                context.Items[CurrentSessionKey] = currentSession;
            }
            return currentSession;
        }

        public static void CloseSession()
        {
            HttpContext context = HttpContext.Current;
            ISession currentSession = context.Items[CurrentSessionKey] as ISession;
            if (currentSession == null)
            {
                // No current session
                return;
            }
            currentSession.Close();
            context.Items.Remove(CurrentSessionKey);
        }


Full stack trace of any exception that occurs:

The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.0'. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:jcs-cache urn:nhibernate-mapping-2.0:cache urn:nhibernate-mapping-2.0:id urn:nhibernate-mapping-2.0:composite-id'.

Source Error:


Line 15: static NHibernateHelper()
Line 16: {
Line 17: sessionFactory = new Configuration().Configure().BuildSessionFactory();
Line 18: }
Line 19:


Source File: C:\Inetpub\wwwroot\GsFusion\GS.Catalog\NHibernateHelper.cs Line: 17

Stack Trace:


[XmlSchemaValidationException: The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.0'. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:jcs-cache urn:nhibernate-mapping-2.0:cache urn:nhibernate-mapping-2.0:id urn:nhibernate-mapping-2.0:composite-id'.]
NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args) +7
System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(ValidationEventHandler eventHandler, Object sender, XmlSchemaValidationException e, XmlSeverityType severity) +53
System.Xml.Schema.XmlSchemaValidator.ElementValidationError(XmlQualifiedName name, ValidationState context, ValidationEventHandler eventHandler, Object sender, String sourceUri, Int32 lineNo, Int32 linePos, Boolean getParticles) +801
System.Xml.Schema.XsdValidator.ValidateChildElement() +202
System.Xml.Schema.XsdValidator.ValidateElement() +53
System.Xml.Schema.XsdValidator.Validate() +66
System.Xml.XmlValidatingReaderImpl.ProcessCoreReaderEvent() +115
System.Xml.XmlValidatingReaderImpl.Read() +43
System.Xml.XmlValidatingReader.Read() +12
System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) +557
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +50
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +162
System.Xml.XmlDocument.Load(XmlReader reader) +96
NHibernate.Cfg.Configuration.LoadMappingDocument(XmlTextReader hbmReader) +177
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream) +64

[MappingException: The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.0'. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:jcs-cache urn:nhibernate-mapping-2.0:cache urn:nhibernate-mapping-2.0:id urn:nhibernate-mapping-2.0:composite-id'.]
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream) +173
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) +243
NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) +158
NHibernate.Cfg.Configuration.DoConfigure(XmlDocument doc) +612
NHibernate.Cfg.Configuration.Configure(XmlTextReader reader) +292
NHibernate.Cfg.Configuration.Configure(XmlNode node) +73
NHibernate.Cfg.Configuration.Configure() +24
GS.Catalog.NHibernateHelper..cctor() in C:\Inetpub\wwwroot\GsFusion\GS.Catalog\NHibernateHelper.cs:17

[TypeInitializationException: The type initializer for 'GS.Catalog.NHibernateHelper' threw an exception.]
GS.Catalog.NHibernateHelper.GetCurrentSession() in C:\Inetpub\wwwroot\GsFusion\GS.Catalog\NHibernateHelper.cs:30
GS.Catalog.CatalogNHibernateDataProvider.GetAllItems() in C:\Inetpub\wwwroot\GsFusion\GS.Catalog\CatalogNHibernateDataProvider.cs:51
GS.Catalog.ItemManager.GetAll() in C:\Inetpub\wwwroot\GsFusion\GS.Catalog\ItemManager.cs:44
_Default.Page_Load(Object sender, EventArgs e) +51
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061





Name and version of the database you are using:
.\SQLExpress



[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 05, 2007 2:50 am 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
At the first glance there is no problem in the mapping of GS.Catalog.Category,GS.Catalog. Is there any other mapping files?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.