Hello

I'm a real newbie to nhibernate.

I try a simple nhibernate connection in my project, but I have
problems I can't solve.

At first I have all references, I think I should have:

Mysql.Data
Iesi.Collections
Linfu.Dynamic.Proxy
NHibernate
Nhibernate.ByteCode.LinFu

Secondly I have my hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <!-- Database connection settings -->
        <property
name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</
property>
        <property name="connection.connection_string">
          Server=localhost;Database=dummy;User ID=t1;Password=1234;</
property>
        <property name="dialect">NHibernate.Dialect.MySQLDialect</
property>
        <property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
        <property name="show_sql">true</property>
        <property
name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu</property>

        <!-- --><mapping resource="Dummy.hbm.xml"/>
    </session-factory>
</hibernate-configuration>


Then I have my Dummy.hbm.xml:
<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="WindowsApplication1.Dummy, WindowsApplication1"
table="dummy">
    <id name="Id">
      <column name="id" />
      <generator class="increment" />
    </id>

    <property name="Text">
      <column name="text"  />
    </property>

  </class>
</hibernate-mapping>

My Dummy class:
Public Class Dummy

    Private id As Integer
    Private text As String

    Public Overridable Property sid() As Integer
        Get
            Return id
        End Get

        Set(ByVal value As Integer)
            id = value
        End Set
    End Property

    Public Overridable Property stext() As String
        Get
            Return text
        End Get

        Set(ByVal value As String)
            text = value
        End Set
    End Property

End Class

And now my connection function:
Dim config As New Configuration
        'NHibernate.Dialect.Dialect.GetDialect()
        config.AddAssembly("WindowsApplication1")
        'config.SetProperty("proxyfactory.factory_class",
"NHibernate.ByteCode.Linfu.ProxyFactoryFactory,
NHibernate.ByteCode.Linfu")

        'Dim myFactory As ISessionFactory =
myConfig.Configure.BuildSessionFactory
        Dim myFactory As ISessionFactory = config.BuildSessionFactory

        Dim mySession As ISession = myFactory.OpenSession

        Dim myTransaction As ITransaction = mySession.BeginTransaction

        Dim cust As New Dummy
        cust.stext = "testest"

        mySession.Save(cust)
        myTransaction.Commit()
        mySession.Close()


I got some different errors


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

Reply via email to