0

I using Oracle rdbms. My mapping looks like this Id(x => x.Tid,"ID").Column("ID").GeneratedBy.TriggerIdentity();

but the SQL request ends up looking like:

NHibernate: INSERT INTO bla bla bla :nhIdOutParam = NULL [Type: Int32 (0)]

Why does nhIdOutParam always return null value?

fluent-nHibernate version is 1.2.0.712. nHibernate version is 3.1.0.4000

Max Kilovatiy
  • 798
  • 1
  • 11
  • 32
  • i thought this would work for oracle, but won't for Postgresql. the insert ends with `returning nhIdOutParam` which assignes the generated id to this out parameter – Firo Feb 16 '12 at 13:40

1 Answers1

0

i thought this would work for oracle, but won't for Postgresql. the insert ends with returning nhIdOutParam which assignes the generated id to this out parameter.

as pseudocode

command.CommandText = sql + " return nhIdOutParam";
command.Parameter.Add(new Parameter { Name = "nhIdOutParam", Type = outparam, Value = 0 });
command.Execute();

returnedId = command.Parameter["nhIdOutParam"].Value;
Firo
  • 30,626
  • 4
  • 55
  • 94