Note that there are some explanatory texts on larger screens.

plurals
  1. PONo persister for class Error
    primarykey
    data
    text
    <p>when i run the application i get "No persister for Test.Student" Error I am new in Nhibernate Mapping ,i can't figure this out<br> How can i solve ?? plz help </p> <p>NHibernate Configuration part </p> <p>App.config</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /&gt; &lt;/configSections&gt; &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt; &lt;session-factory&gt; &lt;property name="connection.provider"&gt; NHibernate.Connection.DriverConnectionProvider &lt;/property&gt; &lt;property name="connection.driver_class"&gt; NHibernate.Driver.SqlClientDriver &lt;/property&gt; &lt;property name="connection.connection_string"&gt; Server=(local);database=Student;Integrated Security=SSPI; &lt;/property&gt; &lt;property name="dialect"&gt; NHibernate.Dialect.MsSql2005Dialect &lt;/property&gt; &lt;!--&lt;property name="proxyfactory.factory_class"&gt; NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernates &lt;/property&gt;--&gt; &lt;property name="show_sql"&gt; false &lt;/property&gt; &lt;/session-factory&gt; </code></pre> <p></p> <p> Main Program </p> <p>program.cs</p> <pre><code> using System; using System.Collections.Generic; using System.Linq; using System.Text; using NHibernate; using NHibernate.Cfg; namespace Test { class Program { static void Main(string[] args) { ISessionFactory factor = new Configuration().Configure().BuildSessionFactory(); if(factor!=null){ Console.WriteLine("Configured"); } else{ Console.WriteLine("Not Configured"); } Student std = new Student { Fname = "James", Lname = "Bond", Address = "32 Baker Street", Institution = "MIT" }; using (ISession session = factor.OpenSession()) { using (ITransaction transaction= session.BeginTransaction()) { try { session.Save(std); transaction.Commit(); session.Close(); } catch(Exception e) { Console.WriteLine("ERROR :" + e); } } } } //protected ISessionFactory factory; protected void execute_query() { } } </code></pre> <p>}</p> <p>Mapping part </p> <p>Student.hbm.xml</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true"&gt; &lt;class name="Test.Student" table="Info" lazy="true"&gt; &lt;id name="Id" type="int" column="Id"&gt; &lt;generator class="native" /&gt; &lt;/id&gt; &lt;property name="Fname" column ="Fname"/&gt; &lt;property name="Lname" column="Lname"/&gt; &lt;property name="Address" column="Address"/&gt; &lt;property name="Institution" column="Institution"/&gt; &lt;!-- We don't have to specify a column name if its the same as the variable name --&gt; </code></pre> <p> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload