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.  [ 2 posts ] 
Author Message
 Post subject: Deleting big objects
PostPosted: Sun Sep 09, 2007 4:32 pm 
Regular
Regular

Joined: Fri Feb 09, 2007 3:47 pm
Posts: 56
I have two tables using a Parent-Child Relation, Child Tables have BLOB data on it.

i have enabled show_sql option.
When i do a session.delete(Parent), Hibernate prints that he's loading all child objects with a "Select", of course, those BLOB objects get loaded and that makes it take a big amount of time. After the "select", hibernate prints some "delect" messages. My question is: Is there any way to cascade delete a parent, and based in the foreign key of each child delete those childs, without the need to load them first.

Someone submited this bug, is related to this or not?
http://jira.nhibernate.org/browse/NH-611

And, if there's no solution how do you it?

Thanks, and sorry my englich


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 15, 2007 3:36 am 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
This problem will exists with big BLOBs, CLOBs, and large sets of data. I once tried to clear out a staging table that help a few million records with an HQL query like this:
"delete from MyClass"

Bad move, I watched my page file grow and grow as the enture table was loaded into the cache for a delete.

For cases such as these, I typically will enlist a ado command into the current NHibernate transaction, do my delete with straight ADO, then return control to the rest of the NHibernate-based code. The only issue here is that the work done with the enlisted command is unmanaged so NHibernate knows nothing about the change in the DB's state (but it still is in the context of the working transaction. I'll often flush before such operations and call session.Clear after.

I wrote something on this a while back:
http://www.lostechies.com/blogs/joshua_ ... ction.aspx

hope that answers your question.

_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


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

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.