Looks like you'll have to do manual SQL to get an object started and won't be able to Save() the object with NHibernate.
And I disagree that this is a common strategy. It's boneheaded for a number of reasons. For instance, if you needed to copy rows from a backup table in to that table, they'd all get new primary keys due to the trigger.
I know you can't change the DB, but the trigger is completely unnecessary.
It saves a couple of characters in the SQL when you do an INSERT *and you don't care about the new primary key*. Other than that, it has absolutely zero benefits over
INSERT INTO foo (x, y, z) VALUES (my_seq.NEXTVAL, yval, zval)
You could use a CHECK constraint to make sure the new ID wasn't greater than the current value of the sequence if you were really paranoid that someone was going to insert a row with an ID that would collide with a future value of the sequence.[/i]
|