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: Could not compile the mapping document
PostPosted: Fri Jun 06, 2008 4:58 am 
Newbie

Joined: Fri Jun 06, 2008 4:40 am
Posts: 3
Hello everybody
I'm sorry that i have to disturb you, but I have a freaking problem.

I've done the QuickStart Guide from here: http://www.hibernate.org/362.html#A7

okay the hole Nhibernate looks very simple.

Now I want to start the hole thing:
Code:
Configuration cfg = new Configuration();
cfg.AddAssembly("QuickStart");


Now I have a problem at the second line:
Could not compile the mapping document: QuickStart.user.hbm.xml

hmmm bad...

My log File:
Code:
NHibernate.MappingException was unhandled
  Message="Could not compile the mapping document: QuickStart.user.hbm.xml"
  Source="NHibernate"
  StackTrace:
       at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 262
       at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 436
       at NHibernate.Cfg.Configuration.ProcessMappingsQueue() in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1557
       at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1548
       at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1541
       at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 506
       at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 544
       at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 615
       at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 601
       at QuickStart.Form1.button1_Click(Object sender, EventArgs e) in C:\data\pkoster\Projekte\Visual C#\IssueTracker\QuickStart\QuickStart\Form1.cs:line 29
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at QuickStart.Program.Main() in C:\data\pkoster\Projekte\Visual C#\IssueTracker\QuickStart\QuickStart\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Collections.Generic.KeyNotFoundException
       Message="The given key was not present in the dictionary."
       Source="mscorlib"
       StackTrace:
            at System.ThrowHelper.ThrowKeyNotFoundException()
            at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
            at NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Dialect\Dialect.cs:line 173
            at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) in c:\DATA\Projects\nhibernate\2.0.x\copy1\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 428
       InnerException:


Hibernate version:
2.0.0.Alpha1

App.conf
Code:
<?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=localhost;initial catalog=nhibernate;Integrated Security=SSPI"
    />
  </nhibernate>
</configuration>




user.hbm.xml:
Code:
user.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="QuickStart.user, QuickStart" table="Device">
    <id name="Id" column="LogonId" type="Int32" length="20" >
      <generator class="assigned">
      </generator>

    </id>
      <property name="UserName" column="Name" type="String" length="40"></property>
      <property name="Password" type="String" length="20"></property>
      <property name="EmailAddress" type="String" length="40"></property>
      <property name="LastLogon" type="DateTime"></property>
   
  </class>
</hibernate-mapping>


I use Visual Studio 2008 (But .NetFramework 2.0)
I googled very long, made many examples but no one works.

Can anybody help me? sorry for my bad english....

mfg - gartenschlauch[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 06, 2008 5:33 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
There are breaking changes in nhibernate 2.0. Have a look at this thread:

http://forum.hibernate.org/viewtopic.php?t=985289

Quote:
# <nhibernate> section is ignored, using <hibernate-configuration> section (note that they have different XML formats)
# Configuration values are no longer prefixed by "hibernate.", if before you would specify "hibernate.dialect", now you specify just "dialect"

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 13, 2008 9:45 am 
Newbie

Joined: Fri Jun 06, 2008 4:40 am
Posts: 3
hey merci wolli, klappt jetzt :)

I've changed my NHibernate version and worked a while on my code.

Now it's working.

I've overwrite the QuickStart for my purpose, you can find my version here:

http://nhibernate.baccus.ch/

I hope i haven't so many failures

thx for your help

mfg - gartenschlauch

PS: jeah I know my english is bullshit o.O


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.