Before stating the problem, please look at the code
Database(Oracle) SQL:
create table test_tab(
id number,
Name varchar2(50)
);
Corresponding Class in C#:
public class TestTable
{
private long id;
public virtual long Id {
get {
return id;
}
set {
id = value;
}
}
private string name;
public virtual string Name
{
get
{
return name;
}
set
{
name = value;
}
}
}
The mapping file for this:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="DataTransfer" namespace="DataTransfer">
<class name="DataTransfer.Models.TestTable, DataTransfer" table="TEST_TAB">
<id name="Id" column="ID" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">
seq_test
</param>
</generator>
</id>
<property name="Name" column="NAME" type="string" not-null="false"/>
</class>
</hibernate-mapping>
The "TestTable" class is inside the Models folder under DataTransfer project
hibernate configuration figuration file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">Data Source=xe;Persist Security Info=True;User ID=hr;Password=hr;Unicode=True</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle9Dialect</property>
<!-- mapping files -->
<mapping assembly="DataTransfer" />
</session-factory>
</hibernate-configuration>
And here is my DataAccessLayer Code;
public void AddToTestTable(Test_Tab user)
{
using (ISession session = GetSession())
{
using (ITransaction tx = session.BeginTransaction())
{
try
{
session.Save(user);
session.Flush();
}
catch (NHibernate.HibernateException)
{
tx.Rollback();
throw;
}
}
}
}
Now the problem is when I insert any value to the database(using simple ASP.NET form) nothing happens(even no exceptions!). But it worked perfectly when i did not use "Models" folder for TestTable Class and "Mappings" folder for mapping files. Please help me out.