I fill a list of objects like this
IQuery query = session.CreateQuery("FROM HibUser_Role as user_role WHERE user_role.ID = :ID");
query.SetParameter("ID", id);
IList<HibUser_Role> roles = query.List<HibUser_Role>();
return new List<HibUser_Role>(roles);
WHen I do a saveorupdate on an object and one allready exists, then try and reload the list of objects from the database, it generates an exception. How can/should I do this. What I want to happen is that my app issues a save or update and doesn't care wether it's saved, updated or ignored as it already exists. I just want to be confident it's there.
The way my app works currently is that I call "FillListBox" which clears down the existing list of objects, the list box and then reloads the list and rebinds the listbox. But this causes an exception if the last saveorupdate failed.
How should I do this? Oh, and yes, I'm very new to nHibernate, but adore the concept...
_________________ Make mine a pint.
|