Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4582

Adding a coded answer to the concept causes ConstraintViolationException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Must
    • Resolution: Fixed
    • Affects Version/s: Platform 1.12.0
    • Fix Version/s: Platform 2.0.0
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      To reproduce:
      1. Edit an existing concept
      2. Set Coded concept datatype
      3. Add another concept as an answer
      4. Save concept

      Version: 1.12.0 SNAPSHOT Build 2b832a
      Stack trace:

      Nested in org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.openmrs.ConceptAnswer]:
      org.hibernate.exception.ConstraintViolationException: could not insert: [org.openmrs.ConceptAnswer]
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
      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:2345)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2852)
      at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
      at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320)
      at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)
      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129)
      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:685)
      at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
      at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252)
      at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392)
      at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335)
      at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
      at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425)
      at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362)
      at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338)
      at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
      at org.hibernate.engine.Cascade.cascade(Cascade.java:161)
      at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:154)
      at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:145)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88)
      at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)
      at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1185)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1709)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
      at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
      at org.openmrs.api.db.hibernate.HibernateAdministrationDAO.getGlobalPropertyObject(HibernateAdministrationDAO.java:181)
      at org.openmrs.api.db.hibernate.HibernateAdministrationDAO.getGlobalProperty(HibernateAdministrationDAO.java:166)
      at org.openmrs.api.impl.AdministrationServiceImpl.getGlobalProperty(AdministrationServiceImpl.java:520)
      at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
      at com.sun.proxy.$Proxy51.getGlobalProperty(Unknown Source)
      at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:125)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at com.sun.proxy.$Proxy53.getGlobalProperty(Unknown Source)
      at org.openmrs.api.impl.AdministrationServiceImpl.getGlobalProperty(AdministrationServiceImpl.java:529)
      at org.openmrs.api.impl.AdministrationServiceImpl.isDatabaseStringComparisonCaseSensitive(AdministrationServiceImpl.java:1231)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
      at com.sun.proxy.$Proxy51.isDatabaseStringComparisonCaseSensitive(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:125)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at com.sun.proxy.$Proxy53.isDatabaseStringComparisonCaseSensitive(Unknown Source)
      at org.openmrs.api.db.hibernate.HibernateConceptDAO.isConceptNameDuplicate(HibernateConceptDAO.java:1825)
      at org.openmrs.api.impl.ConceptServiceImpl.isConceptNameDuplicate(ConceptServiceImpl.java:2028)
      ...
      at org.openmrs.validator.ConceptValidator.validate(ConceptValidator.java:173)
      at org.openmrs.api.db.hibernate.HibernateAdministrationDAO.validate(HibernateAdministrationDAO.java:297)
      at org.openmrs.api.impl.AdministrationServiceImpl.validate(AdministrationServiceImpl.java:1176)
      at com.sun.proxy.$Proxy53.validate(Unknown Source)
      at org.openmrs.validator.ValidateUtil.validate(ValidateUtil.java:97)
      at org.openmrs.web.controller.ConceptFormController.onSubmit(ConceptFormController.java:262)
      ...
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'concept_id' cannot be null
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      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:1015)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2289)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2274)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
      at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
      ... 184 more

        Attachments

          Activity

            People

            Assignee:
            gnarula Gaurav Narula
            Reporter:
            jkondrat Jakub Kondrat
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h