Gethibernatetemplate saveorupdate not updating biggest online dating agencies
based upon your requirement for persisting object into Database.
Along with Spring framework Interview questions, Hibernate questions are also quite popular on J2EE interviews because of its status as leading ORM.
Similar to save method persist also INSERT records into database but return type of persist is void while return type of save is Serializable object.
In hibernate, we generally use one of below two versions of save() method:‘ which is useful in case you have mapped multiple entities to a Java class. ) WARN Sql Exception Helper:144 - SQL Error: -104, SQLState: 23000 ERROR Sql Exception Helper:146 - Violation of unique constraint SYS_PK_49: duplicate value(s) for column(s) ID in statement [insert into Employee (FIRST_NAME, LAST_NAME, ID) values (?
Here you can specify which entity you are saving using save() method. ) Hibernate: insert into Employee (FIRST_NAME, LAST_NAME, ID) values (?
This method updates the associated object if cascade is defined as "save-update".
update(Object object) : Accepts the instance of new entity or any detached object from the session.