These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Exception populating objects after failure.
PostPosted: Wed Sep 19, 2007 3:40 am 
Newbie

Joined: Wed Sep 19, 2007 3:29 am
Posts: 1
Location: London
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.