-->
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.  [ 4 posts ] 
Author Message
 Post subject: bulk update and delete with HQL?
PostPosted: Mon Jan 26, 2004 6:06 am 
Newbie

Joined: Sat Jan 10, 2004 8:02 am
Posts: 15
Location: Munich, Germany
Does Hibenate offer a way to update or delete database table rows
without instanciating java class instances?

Hibernate does support such a construct for bulk deletions using the
Session.delete( String query ) method, but this method seems to
send one sql statement per object, what is not really performant.

I think, hibernate should support bulk update and delete via HQL,
because this should be easy to implement, high performant and
also hides the complexity of SQL from the developer (and
perhaps the end user).

txh,
Juergen


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 6:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, this is not supported and it is not very easy to implement. When deleting objects, Hibernate has to consider cascades, lifecycle objects and others. Use plain SQL for bulk updates and deletes.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 6:20 am 
Newbie

Joined: Sat Jan 10, 2004 8:02 am
Posts: 15
Location: Munich, Germany
OK, I see the problems (better: lot of work to be done ;-)

What is hibernate currently doing, if another user deletes table rows and I want to sync
this changes into my session's objects?

This seems to me an analog problem, that should already be solved in hibernate...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 10:44 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This is really not a problem. "Syncing" two database transactions (Sessions) would be no transaction isolation. This is what you don't want to do.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.