<id name=" AgencyID" column="agencyid"/>

You have an extra slash there...

/Oskar


2009/11/20 raihan <[email protected]>:
> I have been struggling a great deal with NHIbernate – I am trying to
> use it for the first time in a project and getting nowhere with it.
> I would really appreciate anyone's help in figuring out what I am
> doing wrong.
> Here is what I have for the project –
> Assembly name – LicenseServer
> Root Namespace – CXI.LicenseServer
> All my model objects are under CXI.LicenseServer.Model namespace along
> with their mapping files.  Mapping files are compiled as embedded
> resources.
>
> Here is hibernate configuration in app.config –
>
> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
>    <session-factory>
>      <property name="connection.driver_class">
>        NHibernate.Driver.NpgsqlDriver
>      </property>
>      <property name="connection.connection_string">
>        Server=localhost;database=db_test;User
> ID=test_user;Password=test123;
>      </property>
>      <property name="dialect">
>        NHibernate.Dialect.PostgreSQLDialect
>      </property>
>      <property name="show_sql">
>        false
>      </property>
>        <property
> name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
> NHibernate.ByteCode.LinFu</property>
>        <mapping assembly="LicenseServer" />
>    </session-factory>
>  </hibernate-configuration>
>
> Here is part of my Agency object –
>
> using System;
>
> namespace CXI.LicenseServer.Model
> {
>      /// <summary>
>      /// Description of Agency.
>      /// </summary>
>      public class Agency
>      {
>            private string agencyID;
>            public virtual string AgencyID {
>                  get { return agencyID; }
>                  set
>                  {
>                        if(String.IsNullOrEmpty(value)
>                           || value.Trim().Length != 9)
>                        {
>                              throw new ArgumentException("Agency ID
> must be 9 characters long!");
>                        }
>                        agencyID = value;
>                  }
>            }
>
>            private string agencyName;
>            public virtual string AgencyName {
>                  get { return agencyName; }
>                  set { agencyName = value; }
>            }
> }
> }
>
> Here is my Agency.hbm.xml mapping file –
>
> <?xml version="1.0"?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> namespace="CXI.LicenseServer.Model" assembly="LicenseServer">
>    <class name="CXI.LicenseServer.Model.Agency,
> CXI.LicenseServer.Model" table="agency">
>        <id name=" AgencyID" column="agencyid"/>
>            <generator class="assigned" />
>        </id>
>
>        <property name="AgencyName">
>            <column name="agencyname"/>
>        </property>
>    </class>
> </hibernate-mapping>
>
> If I keep the generator element, then I get an error saying generator
> element is invalid child of class element under 2.2 schema.
> If I comment that out, then I get the “Could not configure datastore
> from input stream CXI.LicenseServer.Model.Agency.hbm.xml” error.
>
> I have looked and looked without any luck!  I am just frustrated to
> the point of giving up!  But so many people are using NHibernate out
> there without any issues!
>
> Please help!
> Raihan
>
> --
>
> 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=.
>
>
>

--

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=.


Reply via email to