-->
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: Delete a record
PostPosted: Thu Apr 07, 2011 4:51 am 
Newbie

Joined: Fri Dec 24, 2010 6:44 am
Posts: 1
Hi all,

I'm new to NHibernate and having problems deleting a row from the repository. I keep getting the error:

could not delete collection rows: [BOD.Entities.Hierarchy.Tag.TagImages#b051c925-c09f-46fb-a1e1-0079686e8b4c][SQL: UPDATE [TagImage] SET Tag_id = null WHERE Tag_id = @p0 AND tag_image_id = @p1]

Here is my Code:

ITagRepository<BOD.Entities.Hierarchy.Tag> tagRep = MyRepository<BOD.Entities.Hierarchy.Tag>();
BOD.Entities.Hierarchy.Tag tag = tagRep.Get(image.TagId);

tag.TagImages.Remove(image);
tagRep.DbContext.CommitChanges();

I have also tried using SaveOrUpdate() before the commitchanges() but that still throws an error. Does anyone have any ideas or a general direction I should be looking? I have also tried just using SaveOrUpdate() with commit changes, this proceeeds but deletes nothing.
thanks!


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.