-->
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: Updating an existing record
PostPosted: Tue Feb 01, 2005 9:29 pm 
Beginner
Beginner

Joined: Thu Jul 29, 2004 7:14 pm
Posts: 41
Hibernate version: 2.17

Name and version of the database you are using: MS SQL Server 2000

Hi guys,

I have a question regarding doing an update on an existing record.

Currently when we retrieve data and shows it in jsp, for each dataitem we put a hidden element as well in the form. So if we have a dataitem "shiftname" to be shown as text element then we put it like this :

<input type="text" name="shiftname" size="20" value="Shift A">
<input type="hidden" name="shiftname_o" value="Shift A" >

Suppose user changes the shiftname from "Shift A" to "Shift B". When user click Update, we generate the UPDATE statement; we use the hidden elements to make sure that the values for this record have not been changed in the database.

UPDATE shift
SET shift_name = "Shift B"
WHERE shift_name = "Shift A"
...


Now we are using Hibernate and I am wondering how to accomplish the same task with Hibernate.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 01, 2005 10:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
optimistic-lock="dirty"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 10:29 am 
Beginner
Beginner

Joined: Thu Jul 29, 2004 7:14 pm
Posts: 41
So no need to use version or timestamp columns?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 1:05 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
So no need to use version or timestamp columns?

no, this is for concurrency, nothing to do with simply updating a persistant instance

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.