Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
1.2.40000
Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="NHibernateApplication2.Person, NHibernateApplication2" table="Person" lazy="false">
<id name="PersonId" column="personid" type="integer">
<generator class="assigned" />
</id>
<property name="PersonName" column="name" type="string"/>
<property name="JobTitle" column="jobtitle" type="string"/>
<property name="FrequentFlyer" column="frequentflyer" type="integer"/>
<property name="LastUpdate" column="lastupdated" type="timestamp"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
logger.Info("Accessing all Persons");
try
{
ArrayList allPersons = new ArrayList();
IEnumerable enumerable = session.CreateQuery("FROM Person").Enumerable();
IEnumerator enumerator = enumerable.GetEnumerator();
while(enumerator.MoveNext())
{
Person fetchPerson = enumerator.Current as Person;
if(fetchPerson != null)
{
cmbPersonNames.Items.Add(fetchPerson);
}
}
cmbPersonNames.SelectedIndex = 0;
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
//logger.Error(ex.Message, ex);
MessageBox.Show(ex.Message);
}
finally
{
session.Close();
}
Full stack trace of any exception that occurs:
Name and version of the database you are using:
PostgreSQL, travel_db
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
How to Write only custome messages to log file not all the messages generated by NHibernate session?
Read this:
http://hibernate.org/42.html