I am having exactly the same problem, and exactly the same erraneous INSERT statement with inverse columns (Name, Id) and the question marks for values.
I am also getting an "Error in CREATE Statement" when I am using the hbm2ddl.auto option.
While the initial poster uses Oracle, I get the error with
both Jet and SQL Server, so I wouldn't think it has to do with database connection but that it must be something else.
Can it have to do with me using
Visual C# Express 2005?
This is the hibernate.cfg.xml I have tried using lately. It is loaded from source code implicitly pointing to the file, cause I have yet to find a definite information where NHibernate looks for which file, in fact I am unable to find any useful documentation at all.
I have tried a multitude of configs, configuration from code as well, and it never seems to work.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- Add this element -->
<configSections>
<section
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
/>
</configSections>
<!-- Add this element -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Data Source=.\SQLEXPRESS;AttachDbFilename=C:\CS_PROJECTS\SQLServerApplication\SQLServerApplication\Data.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True</property>
</session-factory>
</hibernate-configuration>
</configuration>
Mapping config in User.hbm.xml :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="HibernateApp.User, HibernateApp" table="User">
<id name="Id" column="Id">
<generator class="assigned" />
</id>
<property name="Name" column="Name"/>
</class>
</hibernate-mapping>
It would be much easier to get started if one could download a basic project that was working. The samples that come with the installation are pretty much useless for a beginner, because every single one has a different way of setting up the project (App.config, Web.config, hibernate.cfg.xml), and none of them will compile.