I read javadoc for session.update() method which said; It update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped with cascade="save-update".
I didn't get the meaning of statement that says; "if there is a persistent instance with the same identifier, an exception is thrown".
Also update method syntax is public void update(Object object) Here we don't pass the Id information to update method so as to determine exactly which record we need to update, thus how does hibernate knows which record to update in database?
|