Hello,
Has anyone tried Map (dictionary) element on NH3x?
I haven't tried with NH2, but the following hbm file is rejected by
NHibernate due to xsd validation (which shouldnt be. The hbm is validated
successfully against the xsd within visual-studio).
The hbm mapping file looks like this.
<class name="Person">
<map name="SomeData">
<key column="PersonId"/>
<index column="AttributeName" type="System.String"/>
<element column="Attributevalue" type="System.String"/>
</map>
</class>
The actual class definition is not relevant because nhibernate won't even
accept this hbm mapping file at all due to the following xsd validation
error:
XML validation error: The element 'map' in namespace
'urn:nhibernate-mapping-2.2' cannot contain text. List of possible
elements expected: 'map-key, composite-map-key, map-key-many-to-many,
index, composite-index, index-many-to-many, index-many-to-any' in
namespace 'urn:nhibernate-mapping-2.2'.
----> System.Xml.Schema.XmlSchemaValidationException : The element
'map' in namespace 'urn:nhibernate-mapping-2.2' cannot contain text.
List of possible elements expected: 'map-key, composite-map-key,
map-key-many-to-many, index, composite-index, index-many-to-many,
index-many-to-any' in namespace 'urn:nhibernate-mapping-2.2'.
at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 340
at NHibernate.Cfg.Configuration.ValidationHandler(Object o,
ValidationEventArgs args) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1838
at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(
XmlSchemaValidationException e, XmlSeverityType severity)
at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(String code,
String[] args)
at System.Xml.Schema.XmlSchemaValidator.ValidateText(String
elementStringValue, XmlValueGetter elementValueGetter)
at System.Xml.Schema.XmlSchemaValidator.ValidateText(XmlValueGetter
elementValue)
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) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1778
at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String
name) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1813
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String
name) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 630
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
in d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 668
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 761
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 744
at NHibernate.Cfg.Configuration.DoConfigure(ISessionFactoryConfiguration
factoryConfiguration) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1539
at NHibernate.Cfg.Configuration.Configure(XmlReader textReader) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1509
at NHibernate.Cfg.Configuration.Configure(String fileName, Boolean
ignoreSessionFactoryConfig) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1431
at NHibernate.Cfg.Configuration.Configure(String fileName) in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1416
at NHibernate.Cfg.Configuration.Configure() in
d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs: line 1402
Anyone has had this problem? I searched in the web and found that this exact
hbm should work in previous version of NH, but not in the current release
i'm using.
Cheers
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.