-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to update a row in hibernate
PostPosted: Fri Mar 25, 2005 1:09 am 
Newbie

Joined: Wed Nov 24, 2004 8:38 am
Posts: 19
Location: India
Hi all,
I want to update a row in a table.Like (sql)update table abc set x=2 where y=1.I want to know how to write this query in hybernate.
With regards,
gs


Top
 Profile  
 
 Post subject: How to update a row in hibernate
PostPosted: Fri Mar 25, 2005 11:50 pm 
Newbie

Joined: Fri Mar 25, 2005 11:44 pm
Posts: 1
Hi,
I have the same problem.
Basically I want to update a particular row in the table.
Can some one give a small example on this.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 6:48 am 
Regular
Regular

Joined: Thu Dec 11, 2003 4:14 pm
Posts: 86
Location: Hibernate 3 + annotations, Oracle 9i, PostgreSQL 8.0, Java 1.5.0
The best start is here:

http://www.hibernate.org/hib_docs/v3/reference/en/html/

There is also a simple exmple
[url]
http://www.hibernate.org/hib_docs/v3/re ... eblog.html
[/url]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2005 8:07 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 6:30 am
Posts: 58
I think gs_1481 wants update some object property without full retrieve object from db like this "update Cat as cat set cat.owner = :newOwner where cat = :cat"

I think it will be very usefull feature.
But as i know there's only sql-update query and it's only in Hibernate 3.
And there isn't a feature to update single object property without object select.


imario wrote:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 1:41 am 
Regular
Regular

Joined: Thu Dec 11, 2003 4:14 pm
Posts: 86
Location: Hibernate 3 + annotations, Oracle 9i, PostgreSQL 8.0, Java 1.5.0
there is dynamic-insert and dynamic-update wich sets only the needet properties.

So yes, you have to retrieve the object but the update is slim.

And then Hibernate3 allows true bulk-updates at least throug HQL.


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