java.sql.SQLException

Unable to run insert stmt on object MetricsBatteryUsage(node=Node(id=16, eui=254, gatewayTable=GatewayTable(id=1, enabled=true, name=MyGw, networkType=MY_SENSORS, timestamp=null, state=UP, statusMessage=Connected Successfully, statusSince=1471093502047, type=SERIAL, properties={br=9600, rdr=pi4j, rf=120, dr=Auto, pn=/dev/ttyAMA0}), name=MyNode, version=null, type=S_ARDUINO_NODE, libVersion=null, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1471093518599, rssi=null, properties={}, parentNodeEui=null, registrationState=REGISTERED), timestamp=1471093518632, samples=1, min=null, max=null, avg=null, aggregationType=RAW, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_battery_usage` (`nodeId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?)

Samebug tips1

Check if you're not creating unused SQL entities, as it might cause this exception.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web9861

  • via GitHub by yd1234
    , 11 months ago
    Unable to run insert stmt on object MetricsBatteryUsage(node=Node(id=16, eui=254, gatewayTable=GatewayTable(id=1, enabled=true, name=MyGw, networkType=MY_SENSORS, timestamp=null, state=UP, statusMessage=Connected Successfully, statusSince
  • via GitHub by cimba007
    , 11 months ago
    =GatewayTable(id=1, enabled=true, name=mosquitto, networkType=MY_SENSORS, timestamp=1470659030270, state=UP, statusMessage=Connected Successfully, statusSince=1471002435640, type=MQTT, properties={p=, u=, bh=tcp://localhost:1883, tp=mysensors-in, cid
  • via GitHub by cimba007
    , 11 months ago
    Unable to run insert stmt on object MetricsDoubleTypeDevice(sensorVariable=SensorVariable(id=3, sensor=Sensor(id=2, sensorId=0, type=S_MOTION, name=, lastSeen=1472079176717, node=Node(id=2, eui=20, gatewayTable=GatewayTable(id=1, enabled=true, name
  • Stack trace

    • java.sql.SQLException: Unable to run insert stmt on object MetricsBatteryUsage(node=Node(id=16, eui=254, gatewayTable=GatewayTable(id=1, enabled=true, name=MyGw, networkType=MY_SENSORS, timestamp=null, state=UP, statusMessage=Connected Successfully, statusSince=1471093502047, type=SERIAL, properties={br=9600, rdr=pi4j, rf=120, dr=Auto, pn=/dev/ttyAMA0}), name=MyNode, version=null, type=S_ARDUINO_NODE, libVersion=null, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1471093518599, rssi=null, properties={}, parentNodeEui=null, registrationState=REGISTERED), timestamp=1471093518632, samples=1, min=null, max=null, avg=null, aggregationType=RAW, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_battery_usage` (`nodeId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?) at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:22)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:135)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:450)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:310)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.create(BaseAbstractDaoImpl.java:184)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.mycontroller.standalone.message.McMessageEngine.internalSubMessageTypeSelector(McMessageEngine.java:250)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.mycontroller.standalone.message.McMessageEngine.execute(McMessageEngine.java:129)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.mycontroller.standalone.message.McMessageEngine.run(McMessageEngine.java:962)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at java.lang.Thread.run(Thread.java:745)[na:1.8.0_101] Caused by: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "AVG"; SQL statement: INSERT INTO `metrics_battery_usage` (`nodeId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?) [23502-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.message.DbException.get(DbException.java:178)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.message.DbException.get(DbException.java:154)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.table.Column.validateConvertUpdateSequence(Column.java:308)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.table.Table.validateConvertUpdateSequence(Table.java:726)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.command.dml.Insert.insertRows(Insert.java:152)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.command.dml.Insert.update(Insert.java:115)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.command.CommandContainer.update(CommandContainer.java:79)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.command.Command.executeUpdate(Command.java:254)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:158)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:144)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:170)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2] ... 7 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Once, 2 months ago
    Once, 1 week ago
    3 times, 2 months ago
    3 times, 2 months ago
    4 times, 3 months ago
    143 more bugmates