[OpenVPMS Developers] [JIRA] (OVPMS-1075) Improve error reporting of duplicate lookups
Improve error reporting of duplicate lookups --------------------------------------------
Key: OVPMS-1075 URL: https://openvpms.atlassian.net/browse/OVPMS-1075 Project: VPMS Web Application Issue Type: Improvement Components: Administration Affects Versions: 1.4 Reporter: Tim Anderson Assignee: Tony De Keizer Priority: Minor
The error message when a lookup is saved with a duplicate code is not particularly helpful. From a 1.5-beta-2 error report: {noformat} org.openvpms.component.business.service.archetype.ArchetypeServiceException: Failed to save object org.openvpms.component.business.domain.im.lookup.Lookup@25665938[id=-1,archetypeId=lookup.macro.1.0,linkId=7360d75e-eaa3-11e0-bc18-899a5332d435,version=0,name=Tibial Wedge No Arthrotomy,code=twonx,default=false] at org.openvpms.component.business.service.archetype.ArchetypeService.save(ArchetypeService.java:499) at sun.reflect.GeneratedMethodAccessor325.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) at $Proxy4.save(Unknown Source) at sun.reflect.GeneratedMethodAccessor325.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:67) at org.openvpms.component.business.service.security.OpenVPMSMethodSecurityInterceptor.invoke(OpenVPMSMethodSecurityInterceptor.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy5.save(Unknown Source) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService$1.run(ArchetypeRuleService.java:308) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService$4.doInTransaction(ArchetypeRuleService.java:507) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService.execute(ArchetypeRuleService.java:504) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService.save(ArchetypeRuleService.java:306) at org.openvpms.component.business.service.archetype.rule.ArchetypeRuleService.save(ArchetypeRuleService.java:276) at org.openvpms.web.component.im.edit.SaveHelper.save(SaveHelper.java:125) at org.openvpms.web.component.im.edit.SaveHelper.save(SaveHelper.java:112) at org.openvpms.web.component.im.edit.AbstractIMObjectEditor.saveObject(AbstractIMObjectEditor.java:496) at org.openvpms.web.component.im.edit.AbstractIMObjectEditor.doSave(AbstractIMObjectEditor.java:484) at org.openvpms.web.component.im.edit.AbstractIMObjectEditor.save(AbstractIMObjectEditor.java:272) at org.openvpms.web.app.admin.lookup.AbstractLookupEditor.save(AbstractLookupEditor.java:81) at org.openvpms.web.component.im.edit.SaveHelper$1.doInTransaction(SaveHelper.java:69) at org.openvpms.web.component.im.edit.SaveHelper$1.doInTransaction(SaveHelper.java:67) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.openvpms.web.component.im.edit.SaveHelper.save(SaveHelper.java:67) at org.openvpms.web.component.im.edit.AbstractEditDialog.save(AbstractEditDialog.java:288) at org.openvpms.web.component.im.edit.AbstractEditDialog.doSave(AbstractEditDialog.java:278) at org.openvpms.web.component.im.edit.AbstractEditDialog.save(AbstractEditDialog.java:260) at org.openvpms.web.component.im.edit.AbstractEditDialog.onOK(AbstractEditDialog.java:194) at org.openvpms.web.component.dialog.PopupDialog.onButton(PopupDialog.java:216) at org.openvpms.web.component.dialog.PopupDialog$2.onAction(PopupDialog.java:342) at org.openvpms.web.component.event.ActionListener.actionPerformed(ActionListener.java:41) at nextapp.echo2.app.button.AbstractButton.fireActionPerformed(AbstractButton.java:135) at echopointng.ButtonEx$1.actionPerformed(ButtonEx.java:120) at nextapp.echo2.app.button.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:70) at echopointng.model.DefaultButtonModelEx.doAction(DefaultButtonModelEx.java:51) at echopointng.ButtonEx.processInput(ButtonEx.java:202) at nextapp.echo2.app.update.ClientUpdateManager.process(ClientUpdateManager.java:116) at nextapp.echo2.app.update.UpdateManager.processClientUpdates(UpdateManager.java:89) at nextapp.echo2.webcontainer.ContainerSynchronizeService.renderUpdate(ContainerSynchronizeService.java:471) at nextapp.echo2.webrender.service.SynchronizeService.service(SynchronizeService.java:279) at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273) at org.openvpms.web.servlet.SpringWebContainerServlet.process(SpringWebContainerServlet.java:148) at nextapp.echo2.webrender.WebRenderServlet.doPost(WebRenderServlet.java:189) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) Caused by: org.openvpms.component.business.dao.im.common.IMObjectDAOException: Failed to save IMObject -1 at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.save(IMObjectDAOHibernate.java:170) at org.openvpms.component.business.service.archetype.ArchetypeService.save(ArchetypeService.java:492) ... 83 more Caused by: org.springframework.dao.DataIntegrityViolationException: could not insert: [org.openvpms.component.business.dao.hibernate.im.lookup.LookupDOImpl]; SQL [insert into lookups (version, linkId, active, arch_short_name, arch_version, code, name, description, default_lookup) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.openvpms.component.business.dao.hibernate.im.lookup.LookupDOImpl] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:637) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate$9$1.doInHibernate(IMObjectDAOHibernate.java:1086) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate$9.doInTransaction(IMObjectDAOHibernate.java:1082) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.update(IMObjectDAOHibernate.java:1080) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.save(IMObjectDAOHibernate.java:163) ... 84 more Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [org.openvpms.component.business.dao.hibernate.im.lookup.LookupDOImpl] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2176) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:535) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:527) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:523) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.save(IMObjectDAOHibernate.java:991) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.save(IMObjectDAOHibernate.java:881) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.save(IMObjectDAOHibernate.java:863) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.access$000(IMObjectDAOHibernate.java:98) at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate$1.doInHibernate(IMObjectDAOHibernate.java:165) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ... 92 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'lookup.macro-twonx' for key 'arch_short_name' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1016) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2022) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1940) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1925) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57) ... 112 more {noformat} On error, the code should look for a ConstraintViolationException. If one is present and a duplicate lookup exists, it should report accordingly
-- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://openvpms.atlassian.net/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________ OpenVPMS Developers Mailing List developers@lists.openvpms.org To unsubscribe or change your subscription visit: http://lists.openvpms.org/listinfo/developers Posts from this mailing list can be viewed online and replied to in the OpenVPMS Developer's forum- http://tinyurl.com/openvdf