NULL error when trying to set Min-Max values (extra fields in db table)

Using 2.11 with a recent Chrome:

Manually setting Min-Max values for a particular data element/catcombo field in the data entry seems to work fine in the online demo. It also works fine in my local installation which uses the demo db - but on the machines of many of my colleagues the values are not saved (the fields become red instead of green).

There seems to be a problem with my minmaxdataelement table - it contains both

minvalue, maxvalue and minimumvalue, maximumvalue

I suppose there is some SQL that should be run to fix this?

The log says the following:

ERROR 12:51:54,297 Error while executing action (ExceptionInterceptor.java [9426007@qtp-30488988-48])

org.springframework.dao.DataIntegrityViolationException: ERROR: null value in column “minvalue” violates not-null constraint

Detail: Failing row contains (1921, 371, 44, 15, null, null, f, 10, 20).; SQL [n/a]; constraint [minvalue]; nested exception is org.hibernate.exception.ConstraintViolationException: ERROR: null value in column “minvalue” violates not-null constraint

Detail: Failing row contains (1921, 371, 44, 15, null, null, f, 10, 20).

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:594)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:476)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at com.sun.proxy.$Proxy59.addMinMaxDataElement(Unknown Source)

at org.hisp.dhis.de.action.SaveMinMaxLimitsAction.execute(SaveMinMaxLimitsAction.java:153)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)
···


Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

http://dhis2.org

Hello,

TableAlteror.java

executeSql( “ALTER TABLE minmaxdataelement RENAME minvalue TO minimumvalue” );

executeSql( “ALTER TABLE minmaxdataelement RENAME maxvalue TO maximumvalue” );

It looks like minvalue and maxvalue are no longer used. Maybe dropping those columns will solve your problem.

Regards,

Paulo Grácio

···

From: Dhis2-users [mailto:dhis2-users-bounces+pgracio=criticalsoftware.com@lists.launchpad.net] On Behalf Of Knut Staring
Sent: quinta-feira, 18 de Abril de 2013 14:01
To: dhis2-users@lists.launchpad.net
Subject: [Dhis2-users] NULL error when trying to set Min-Max values (extra fields in db table)

Using 2.11 with a recent Chrome:

Manually setting Min-Max values for a particular data element/catcombo field in the data entry seems to work fine in the online demo. It also works fine in my local installation which uses the demo db - but on the machines of many of my colleagues the values are not saved (the fields become red instead of green).

There seems to be a problem with my minmaxdataelement table - it contains both

minvalue, maxvalue and minimumvalue, maximumvalue

I suppose there is some SQL that should be run to fix this?

The log says the following:

ERROR 12:51:54,297 Error while executing action (ExceptionInterceptor.java [9426007@qtp-30488988-48])

org.springframework.dao.DataIntegrityViolationException: ERROR: null value in column “minvalue” violates not-null constraint

Detail: Failing row contains (1921, 371, 44, 15, null, null, f, 10, 20).; SQL [n/a]; constraint [minvalue]; nested exception is org.hibernate.exception.ConstraintViolationException: ERROR: null value in column “minvalue” violates not-null constraint

Detail: Failing row contains (1921, 371, 44, 15, null, null, f, 10, 20).

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:594)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:476)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at com.sun.proxy.$Proxy59.addMinMaxDataElement(Unknown Source)

at org.hisp.dhis.de.action.SaveMinMaxLimitsAction.execute(SaveMinMaxLimitsAction.java:153)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

http://dhis2.org

Hi Knut,

Paulo is right… but I would suggest first drop these columns with

alter table minmaxdataelement drop column maximumvalue;

alter table minmaxdataelement drop column minimumvalue;

Then apply Paolo’s statements:

ALTER TABLE minmaxdataelement RENAME minvalue TO minimumvalue

ALTER TABLE minmaxdataelement RENAME maxvalue TO maximumvalue

Something must have gone wrong during the upgrade process. But I have tested at a few databases here now and not able to reproduce or understand why it happens.

Lars