-->
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: why there's no Session.delete(Class type, Object id) ?
PostPosted: Thu Jan 06, 2005 8:15 am 
Newbie

Joined: Thu Jan 06, 2005 8:05 am
Posts: 13
Hi.

Im beginning to work with Hibernate and some things are confusing...
Why there's no something like Session.delete(Class type, Object id) ?

In my web app, in delet request I have been given ID of persisted object to be deleted, and I would like to do it in one DELETE command, but unfortunately I have to do one SELECT first to fecth this object (Session.load), and then DELETE it by Session.delete(object).

One question also, I noticed looking at sql commands issued by hibernate, when doing inserting new object, it first does SELECT hibernate_sequence.nextVal separately, and then does INSERT in following command, whereas placing sequenece incrementation inside INSERT would save us one round-trip, right?

Thanx,
Vjeran


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 06, 2005 3:28 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
1. there will be a delete(query) in H3
But you have to knwo that hibernate will load your objects anyway (due to cascading lifecycle etc etc)
2. use the sequence hilo generator if you absolutly need to minimize DB roundtrips on insert.

_________________
Emmanuel


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.