Spring hibernatetemplate saveorupdate not updating
I have read that save Or Update() will update the table entry if there is a record present for that ID, and if the id is not present then it simply insert the record. I have a Role Table like Role_id | Role_Name | Create_Time | Create_User | Update_Time | Update_USer1 Admin At null nullnow when from the UI when an update is happen, I just use this, they are set to null.The only thing that seems a little confusing is that the rolename is unchanged. Do you think Hibernate has to show the statement in it' logs? , update_user......means it is updating all the things, while it should only update the update_time=? Calling save Or Update() with a detached instance simply assumes that all properties has been modified since Hibernate doesn't know the initial state.However, following the call to Save Or Update, the value is ALWAYS set to 1. Thanks I finally figured out what was causing this issue.This is always the case regardless of the unsaved-value. One of the triggers on the associated table did not have the SET NOCOUNT ON specified.Hibernate just holds the state of the new object, loaded object and updated object.
Hibernate - save Or Update problem Hy, I'm using Hibernate 2.1.6 and Spring 1.1.0.Then you have to set the right property in your xml, set show_sql to you are right in terms of save Or Update() is doing something, but not according to my knowledge on that,and role Name is not changed because from the UI i am getting its value and it is common for adding a role or updating a role. , update_userand if the value of create_user and create time is filled previously then update query generated is like what i have posted in previous post.. Using the select-before-update option will not help, since it is only used to confirm that at least a few values has been changed.