update - update method in the hibernate is used for updating the object using identifier. If the identifier is missing or doesn't exist, it will throw exception.
saveOrUpdate - This method calls save() or update() based on the operation. If the identifier exists, it will call update method else the save method will be called.
Note:
if you use "unsaved-value="null" " property in .hbm xml this
SaveOrUpdate will not work
EX: <id name="accountID" column="ACCOUNT_ID" type="java.lang.String"
unsaved-value="null">
No comments:
Post a Comment