-->
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.  [ 3 posts ] 
Author Message
 Post subject: Optimized update/delete
PostPosted: Tue Apr 06, 2004 7:58 pm 
Newbie

Joined: Tue Apr 06, 2004 7:46 pm
Posts: 4
Hibernate version: 2.1

Hello,

I would like to know how I can do the following with Hibernate:

DELETE FROM T1 WHERE T1_FK=? - delete a bunch of objects w/o instantiating them. The session methods seem to all be based on first reading the objects. Is there any better way than writing this with plain JDBC, i.e can I still refer to the mapped names rather than plain table and column names?

UPDATE T1 SET T1_COL=? - update a particular column, not the entire object (relevant for tables with a large number of columns or expensive to update columns). Is there a way that would allow me to specify the attribute(s) to update, instead of automatically updating all attributes.

Thank you!
Thomas


Top
 Profile  
 
 Post subject: Re: Optimized update/delete
PostPosted: Wed Apr 07, 2004 7:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
tweise wrote:
DELETE FROM T1 WHERE T1_FK=? - delete a bunch of objects w/o instantiating them. The session methods seem to all be based on first reading the objects. Is there any better way than writing this with plain JDBC, i.e can I still refer to the mapped names rather than plain table and column names?

This is quite impossible : Object dependencies are required due to lifecycle, interceptors, cascading etc...

tweise wrote:
UPDATE T1 SET T1_COL=? - update a particular column, not the entire object (relevant for tables with a large number of columns or expensive to update columns). Is there a way that would allow me to specify the attribute(s) to update, instead of automatically updating all attributes.

<class dynamic-update="true" ...>
This is usually not an optimization since Hibernate cannot prepare queries.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 7:23 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
And have a look at the reference guide, most of these questions are answered.

_________________
Emmanuel


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