I have a table, Book, with an assigned primary key, BookId:
Code:
<id name="BookId" column="bookId" type="Int32" unsaved-value="0">
<generator class="assigned"/>
</id>
When saving a new Book (not updating), I want to get a primary key violation error if a book exists with the same Id. Now, even when i explicitly call session.Save(book), NHibernate updates the row... Why does this happen, and why is there Update()/SaveOrUpdate()-methods if Save() does this anyway..
Using NHibernate 1.0.1, SQL Server 2005 Express, Visual Studio 2005, C#, .NET 2.0