Posts

Showing posts from March, 2014

Hibernate Difference between update() and merge()

Image
In order to explain the difference between update and merge, I have created an example, which you can execute or just read it to understand the difference. 1. First Create a database medireports: (DB=MySQL) CREATE DATABASE `medireports` 2. Now Create a 'reports' table: CREATE TABLE `reports` ( `reportid` varchar(20) NOT NULL, `report` mediumblob, `phonenumber` bigint(20) NOT NULL, `labid` varchar(45) DEFAULT NULL, `retainreport` varchar(45) DEFAULT NULL, `reportdate` date DEFAULT NULL, `filename` varchar(65) DEFAULT NULL, PRIMARY KEY (`reportid`) ) 3. Insert data into the reports table: INSERT INTO `medireports`.`reports`(`reportid`,`phonenumber`,`retainreport`,`reportdate`,`filename`) VALUES ('ZL1234', '9999666222', '0', '2014-03-13', 'jqModal.js'); INSERT INTO `medireports`.`reports`(`reportid`,`phonenumber`,`retainreport`,`reportdate`,`filename`) VALUES ('ZL123456&