Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
NHibernate version:
1.0.1.0
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--Generated from NHibernate.Mapping.Attributes on 2006-01-15 09:52:27Z.-->
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="BibLog.Hbm.Kategoria, BibLog-lib">
<id column="id">
<generator class="native" />
</id>
<property name="nazwa" not-null="true" />
</class>
<class name="BibLog.Hbm.Wydanie, BibLog-lib">
<id column="id" />
<property name="tytul" not-null="true" />
<property name="isbn" unique="true" />
<property name="rokWydania" column="rok_wydania" not-null="false" />
<many-to-one name="kategoria" not-null="true" />
<set name="autorzy" table="WydanieAutor">
<key column="wydanie_id" />
<many-to-many class="BibLog.Hbm.Autor, BibLog-lib" column="autor_id" />
</set>
</class>
<class name="BibLog.Hbm.Autor, BibLog-lib">
<id column="id" />
<property name="imie" />
<property name="nazwisko" />
<property name="pseudonim" />
</class>
<class name="BibLog.Hbm.Ksiazka, BibLog-lib">
<id column="id" />
<property name="iboId" column="ibo_id" not-null="true" />
<many-to-one name="kategoria" not-null="true" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:Bad schema validation (empty id element).
Code:
NHibernate.MappingException: The element 'id' in namespace 'urn:nhibernate-mapping-2.0' has incomplete content. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:column urn:nhibernate-mapping-2.0:generator'. ---> System.Xml.Schema.XmlSchemaValidationException: The element 'id' in namespace 'urn:nhibernate-mapping-2.0' has incomplete content. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:column urn:nhibernate-mapping-2.0:generator'.
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.CompleteValidationError(ValidationState context, ValidationEventHandler eventHandler, Object sender, String sourceUri, Int32 lineNo, Int32 linePos, Boolean getParticles)
at System.Xml.Schema.XsdValidator.ValidateEndElement()
at System.Xml.Schema.XsdValidator.Validate()
at System.Xml.XmlValidatingReaderImpl.ProcessCoreReaderEvent()
at System.Xml.XmlValidatingReaderImpl.Read()
at System.Xml.XmlValidatingReader.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(XmlTextReader hbmReader)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
at BibLog.DAO.DAO`1.Init(String connString) in c:\Documents and Settings\Maciej Piechotka\Moje dokumenty\SharpDevelop Projects\BibLog-lib\DAO.cs:line 34
at BibLog.DAO.DAO`1.Init(String host, String user, String pass, String db) in c:\Documents and Settings\Maciej Piechotka\Moje dokumenty\SharpDevelop Projects\BibLog-lib\DAO.cs:line 20
at BibLog.GUI.LogIn.OnResponse(ResponseType type) in c:\Documents and Settings\Maciej Piechotka\Moje dokumenty\SharpDevelop Projects\BibLog\BibLogGui\LogIn.cs:line 32
at Gtk.Dialog.response_cb(IntPtr dialog, Int32 response_id)
at Gtk.Dialog.gtk_dialog_run(IntPtr raw)
at Gtk.Dialog.Run()
at BibLog.GUI.BibLog.Main(String[] args) in c:\Documents and Settings\Maciej Piechotka\Moje dokumenty\SharpDevelop Projects\BibLog\BibLogGui\BibLog.cs:line 12}
Code:Code:
using System;
using System.Collections;
using NHibernate.Mapping.Attributes;
namespace BibLog.Hbm {
[Class]
public class Autor {
[Id(Column="id")]
[Generator(Class="native")]
public ulong id;
[Property]
public String imie;
[Property]
public String nazwisko;
[Property]
public String pseudonim;
}
[Class]
public class Kategoria {
[Id(Column="id")]
[Generator(Class="native")]
public ulong id;
[Property(NotNull=true)]
public String nazwa;
}
[Class]
public class Ksiazka
{
[Id(Column="id")]
[Generator(Class="native")]
public ulong id;
[ManyToOne(NotNull=true)]
public Wydanie kategoria;
[Property(NotNull=true,Column="ibo_id")]
public ulong iboId;
}
[Class]
public class Wydanie {
[Id(Column="id")]
[Generator(Class="native")]
public ulong id;
[Property(NotNull=true)]
public String tytul;
[Property(Unique=true)]
public String isbn;
[Property(NotNull=false, Column="rok_wydania")]
public DateTime rokWydania;
[ManyToOne(NotNull=true)]
public Kategoria kategoria;
[Set(Table="WydanieAutor")]
[Key(Column="wydanie_id")]
[ManyToMany(Column="autor_id", ClassType=typeof(Autor))]
public ICollection autorzy;
}
}
What's wrong?
I don't understand it...
(And with access attrubute is all ok?)
Regards