-->
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: Delete with only the class and id not an instance
PostPosted: Tue Jan 10, 2006 1:14 pm 
Newbie

Joined: Tue Jan 10, 2006 10:00 am
Posts: 5
I am refactoring an existing application to use hibernate. Where deletes are concerned the backend only receives the id of the object to delete from the DB. It seems like a waste to use the id to get hibernate to create an instance so I can then ask hibernate to remove it!

Why does Session not have a method to delete by class and id? It seems that this might be a common thing to do..

What is the best way to do this currently with hibernate3?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 6:40 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
you can simply create a query deleting your instance.

Regards Sebastian

Please rate, if this helped.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.