I too am using MS Sqlserver 2000 and Hibernate 2.1.8 and am getting the same error message:
Cannot insert explicit value for identity column in table 'Session' when IDENTITY_INSERT is set to OFF
guenz wrote:
net.sf.hibernate.dialect.SQLServerDialect
I am using the above dialect and also this code
Code:
<id name="sessionId" type="int" column="SESSION_ID" unsaved-value="null">
<generator class="identity" />
</id>
I have the SESSION_ID column set to Identity=Yes on the Sqlserver database table, so there should not be a matchup problem between the generator and the identity column.
When I first encountered this problem, I was using the Microsoft driver until I found the FAQ in which it is stated that the MS driver is not supported in Hibernate. I then installed the JSQLConnect driver and still got the same error message