I played around with WilsonNHibernateExample (
http://weblogs.asp.net/pwilson/archive/ ... 09042.aspx).
It is a nice example program and I got it working with MySql. But when I try to get it to work with FireBird I seem te have problems with the Contacts table.
I think it has to do with te AutoInc field in MySql and the lack of it in FireBird.
So I created the contact table like this:
CREATE GENERATOR "CONTACTS_GENERATOR";
CREATE TABLE "CONTACTS"
(
"CONTACTID" INTEGER NOT NULL,
"CONTACTNAME" VARCHAR(50) NOT NULL,
"CONTACTTYPE" CHAR(1) NOT NULL,
"COMPANYNAME" VARCHAR(50),
"ADDRESSLINE" VARCHAR(50),
"ADDRESSCITY" VARCHAR(50),
"ADDRESSSTATE" VARCHAR(2),
"ADDRESSZIP" VARCHAR(5),
PRIMARY KEY ("CONTACTID")
);
SET TERM ^ ;
/* Triggers only will work for SQL triggers */
CREATE TRIGGER "CONTACTS_BI" FOR "CONTACTS"
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
NEW.ContactId = GEN_ID(CONTACTS_GENERATOR, 1);
END
^
COMMIT WORK ^
SET TERM ;^
Changed the mapping file to:
<id name="Id" column="ContactId" access="nosetter.camelcase" unsaved-value="0">
<!--generator class="identity" /-->
<generator class="sequence" />
</id>
And it ttill doesn't work. I get an error "Could not save object" when I process the line session.SaveOrUpdate(this.contact);
So how do I use FireBird with a generator?
Bas