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.  [ 3 posts ] 
Author Message
 Post subject: cascade-attribute was not declared
PostPosted: Thu Jan 31, 2008 4:44 am 
Beginner
Beginner

Joined: Tue Jan 22, 2008 11:33 am
Posts: 46
Hi,

I try to use a cascade-Attribute in a many-to-one-section. It always says cascade-attribute was not declared? The documentation says in Paragraph "5.1.10.many-to-one" that cascade is a valid attribute and value I use is also mentioned there. What could be the problem?

NHibernate version: 1.2.1

Mapping documents:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="DocExpert.Anwenderstammdaten.BusinessObject.AttributeValueOfOrganizationalUnitInPath,DocExpert.Anwenderstammdaten.BusinessObject" table="AttributeValueOfOrganizationalUnitInPath" lazy="true">
<id name="AttributeValueId" column="AttributeValueId" type="int">
<generator class="native" />
</id>
<property type="DateTime" not-null="true" name="ValidFromDate" column="ValidFromDate" />
<property type="DateTime" not-null="true" name="ValidToDate" column="ValidToDate" />
<property type="string" length="10" name="Value" column="Value" />
<many-to-one name="OrganizationalUnitPathId" column="OrganizationalUnitPathId" cascade="none" not-null="true" />
<many-to-one name="OrganizationalUnitTypeId">
<column name="OrganizationalUnitTypeId" cascade="none" />
<column name="AttributeId" cascade="none" />
</many-to-one>
<many-to-one name="AttributePriorityId" column="AttributePriorityId" cascade="none" />
</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:
NHibernate.MappingException wurde nicht behandelt.
Message="DocExpert.Anwenderstammdaten.BusinessObject.Mappings.AttributeValueOfOrganizationalUnitInPath.hbm.xml(14,47): XML validation error: Das cascade-Attribut wurde nicht deklariert."
Source="NHibernate"
StackTrace:
bei NHibernate.Cfg.Configuration.LogAndThrow(MappingException me)
bei NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args)
bei System.Xml.Schema.BaseValidator.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity)
bei System.Xml.Schema.XsdValidator.ValidateStartElement()
bei System.Xml.Schema.XsdValidator.ProcessElement(Object particle)
bei System.Xml.Schema.XsdValidator.ValidateElement()
bei System.Xml.Schema.XsdValidator.Validate()
bei System.Xml.XmlValidatingReaderImpl.ProcessCoreReaderEvent()
bei System.Xml.XmlValidatingReaderImpl.Read()
bei System.Xml.XmlValidatingReader.Read()
bei System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
bei System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
bei System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
bei System.Xml.XmlDocument.Load(XmlReader reader)
bei NHibernate.Cfg.Configuration.LoadMappingDocument(XmlTextReader hbmReader, String name)
bei NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name)
bei NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
bei NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
bei NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
bei NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
bei DocExpert.Anwenderstammdaten.Explorer.Program.Main() in C:\Dokumente und Einstellungen\All Users\Dokumente\Visual Studio 2005\Projects\Anwenderstammdatentest\Anwenderstammdaten\Program.cs:Zeile 29.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()


Name and version of the database you are using: MS SQL 2005 Express

configuration file♦:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
</configSections>

<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Server=.\SQLEXPRESS;initial catalog=[Database Name];Integrated Security=SSPI"
/>
</nhibernate>
</configuration>


Top
 Profile  
 
 Post subject: cascade-attribute was not declared
PostPosted: Thu Jan 31, 2008 9:03 am 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi,

It's just a guess, but perhaps the code

Code:
<many-to-one name="OrganizationalUnitTypeId">
    <column name="OrganizationalUnitTypeId" cascade="none" />
    <column name="AttributeId" cascade="none" />
</many-to-one>


should be

Code:
<many-to-one name="OrganizationalUnitTypeId" cascade="none">
    <column name="OrganizationalUnitTypeId" />
    <column name="AttributeId" />
</many-to-one>


Regards,
Richard


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 10:16 am 
Beginner
Beginner

Joined: Tue Jan 22, 2008 11:33 am
Posts: 46
Hi Richard,

thanks, it works. It makes sense since it should not be possible to do different cascading on two properties.

Again thank you for your support. I did not figure it myself

antoscka


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.