Hi,
I have problem in my application where the insert query is getting executed twice when i get into the catch loop of the DataIntegrityViolationException. This happens only in MS-SQL server database not in Oracle.
Code snippet below,
try { getHibernateTemplate().save(saveObj); getHibernateTemplate().flush(); } catch (DataIntegrityViolationException e) { System.out.println("Inside DataIntegrityViolationException ------------------->>>>>>>>>>>>> "+e); }
I have used SOPs, please find the log below,
Hibernate: update ADMIN.USER set CNT=? where DATE=? after save...before flush() #############
Hibernate: insert into TEST.USER (DESC, CODE) values (?, ?) Inside DataIntegrityViolationException ------------------->>>>>>>>>>>>> org.springframework.dao.DataIntegrityViolationException: could not insert: [com.med.autocoder.domain.AutocoderDiagnosisCache]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [com.med.autocoder.domain.AutocoderDiagnosisCache] Hibernate: insert into TEST.USER (DESC, CODE) values (?, ?) - Extra insert that happens inside the exception loop.
Please can you help in resolving this issue. This code works fine on the oracle databaase. This error comes up only in MS-SQL dabatabase.
Thanks, Halel
|