Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
I love this place!
Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
I love this place!
Sean Clark wrote:Hey,
you would actually set update="false" on the fields that you didn't want to update. In your case I don't think that would be advisable as you would then never be able to update the password or gender.
The reason it updates all is that hibernate has no way of knowing if any of the fields have changed (it would need to do a select first to get the data, which is less efficient), so it updates all.
If it is very important that only some fields update I'd say to load/get the object using the primary key and then update the fields that you wish to update.
Sean
(it would need to do a select first to get the data, which is less efficient)
I'd say to load/get the object using the primary key and then update the fields that you wish to update.
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
(it would need to do a select first to get the data, which is less efficient)
I'd say to load/get the object using the primary key and then update the fields that you wish to update.
I love this place!
Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
knowledge is the difference between drudgery and strategic action -- tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|