I need to write a row to the database regardless of whether it already exists or not. Before using NHibernate this was done with a stored procedure. The procedure would attempt
You can do
Obj j = session.get(Object.class(), id); if (j != null) session.merge(myObj); else session.saveOrUpdate(myObj);