sreenivasa k

sreenivasa k

  • 890
  • 893
  • 34.2k

Sequence generator in Nhibernate (c#)

Jan 16 2018 11:57 AM
Hi All,
 
I have a conversion project (from oracle to sql server) and using NHibernate to handle database operations. 
 
1. Saving is working when we Save entity  by using oracle . here for a column has sequence
2. But same if we do in SQL server it is not working as getting 'null Identifier' 
 
Query:
Insert into Dept(deptname, loc) values (@po,@p1) scope_identity, @p0='IT' , @p1='Hyd'
Exception: null Identifier.
 
dept.hbm.xml
 
<id name="id" column="deptid">
<generator class="identity">
<param name="sequence">SEQ_DEPT_ID</param>
</generator>
</id>
 
Note: we are using Instead of Insert triggers in SQL server. 
 
Please help . thanks in advance. 

Answers (1)