java.sql.SQLException: Unable to run insert stmt on object MetricsBinaryTypeDevice(sensorVariable=SensorVariable(id=7, sensor=Sensor(id=8, sensorId=4, type=S_BINARY, name=Status salon, lastSeen=1472052735701, node=Node(id=4, eui=2, gatewayTable=GatewayTable(id=1, enabled=true, name=g1, networkType=MY_SENSORS, timestamp=null, state=UP, statusMessage=Connected Successfully, statusSince=1471813237223, type=SERIAL, properties={br=115200, rdr=pi4j, rf=120, dr=Auto, pn=/dev/ttyUSB0}), name=Thermostat, version=1.1, type=S_ARDUINO_REPEATER_NODE, libVersion=2.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1472052735707, rssi=null, properties={}, parentNodeEui=null, registrationState=REGISTERED), room=null, variableTypes=[Status]), variableType=V_STATUS, metricType=BINARY, timestamp=1472052735738, value=0, previousValue=0, unitType=U_NONE, readOnly=false, offset=0.0, priority=100, graphProperties={color=#ff7f0e, interpolate=linear, subType=line, useGlobal=true, type=lineChart}), timestamp=1472052735738, state=false, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_binary_type_device` (`sensorVariableId` ,`timestamp` ,`state` ) VALUES (?,?,?)

GitHub | gbrd | 4 months ago
  1. 0

    ERROR log: Unique index or primary key violation

    GitHub | 4 months ago | gbrd
    java.sql.SQLException: Unable to run insert stmt on object MetricsBinaryTypeDevice(sensorVariable=SensorVariable(id=7, sensor=Sensor(id=8, sensorId=4, type=S_BINARY, name=Status salon, lastSeen=1472052735701, node=Node(id=4, eui=2, gatewayTable=GatewayTable(id=1, enabled=true, name=g1, networkType=MY_SENSORS, timestamp=null, state=UP, statusMessage=Connected Successfully, statusSince=1471813237223, type=SERIAL, properties={br=115200, rdr=pi4j, rf=120, dr=Auto, pn=/dev/ttyUSB0}), name=Thermostat, version=1.1, type=S_ARDUINO_REPEATER_NODE, libVersion=2.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1472052735707, rssi=null, properties={}, parentNodeEui=null, registrationState=REGISTERED), room=null, variableTypes=[Status]), variableType=V_STATUS, metricType=BINARY, timestamp=1472052735738, value=0, previousValue=0, unitType=U_NONE, readOnly=false, offset=0.0, priority=100, graphProperties={color=#ff7f0e, interpolate=linear, subType=line, useGlobal=true, type=lineChart}), timestamp=1472052735738, state=false, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_binary_type_device` (`sensorVariableId` ,`timestamp` ,`state` ) VALUES (?,?,?)
  2. 0

    GitHub comment 241#239619972

    GitHub | 4 months ago | yd1234
    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 (?,?,?,?,?,?,?)
  3. 0

    constraint primary index

    GitHub | 4 months ago | cimba007
    java.sql.SQLException: Unable to run insert stmt on object MetricsDoubleTypeDevice(sensorVariable=SensorVariable(id=46, sensor=Sensor(id=35, sensorId=0, type=S_LIGHT_LEVEL, name=Photoresistor GL5549 (v4), lastSeen=1471356147821, node=Node(id=12, eui=11, gatewayTable=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=mycontroller-mqtt-client, ts=mysensors-out}), name=LightClass_Test, version=Aug 15 2016 | 19:01:30, type=S_ARDUINO_NODE, libVersion=null, batteryLevel=100, eraseConfig=null, firmware=null, state=UP, lastSeen=1471356147804, rssi=null, properties={}, parentNodeEui=null, registrationState=REGISTERED), room=null, variableTypes=[Light level]), variableType=V_LIGHT_LEVEL, metricType=DOUBLE, timestamp=1471356147829, value=25.0, previousValue=25.0, unitType=U_LIGHT_LEVEL, readOnly=false, offset=0.0, priority=100, graphProperties={color=#ff7f0e, interpolate=linear, subType=line, useGlobal=true, type=lineChart}), timestamp=1471356147829, samples=1, min=null, max=null, avg=25.0, aggregationType=RAW, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 253#242234204

    GitHub | 4 months ago | cimba007
    java.sql.SQLException: Unable to run insert stmt on object MetricsDoubleTypeDevice(sensorVariable=SensorVariable(id=2, sensor=Sensor(id=2, sensorId=0, type=S_MOTION, name=, lastSeen=1472079115687, node=Node(id=2, eui=20, gatewayTable=GatewayTable(id=1, enabled=true, name=mosquitto, networkType=MY_SENSORS, timestamp=1472065324018, state=UP, statusMessage=Connected Successfully, statusSince=1472078288689, type=MQTT, properties={p=, u=, bh=tcp://localhost:1883, tp=mygateway-in, cid=mycontroller_mqtt_client, ts=mygateway-out}), name=MicrowaveTest, version=Aug 25 2016 | 00:51:10, type=S_ARDUINO_NODE, libVersion=2.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1472079104913, rssi=52|52|0|52, properties={}, parentNodeEui=0, registrationState=REGISTERED), room=null, variableTypes=[Variable 1, Variable 2]), variableType=V_VAR1, metricType=DOUBLE, timestamp=1472079118275, value=16.13, previousValue=220.28, unitType=U_NONE, readOnly=false, offset=0.0, priority=100, graphProperties={color=#ff7f0e, interpolate=linear, subType=line, useGlobal=true, type=lineChart}), timestamp=1472079118275, samples=1, min=16.13, max=16.13, avg=16.13, aggregationType=RAW, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?)
  6. 0

    H2 - General error: “java.util.ConcurrentModificationException” [50000-188]

    Stack Overflow | 1 year ago | Franck Yapadesouci Anso
    java.sql.SQLException: Unable to run insert stmt on object DoorOpening{start=2015-09-14T18:20:32.932+02:00, end=null, device=Device{id=1601138, type=DOOR_MAGNET_SENSOR, whereInstalled=Room{id=406, label=entree principale, type=OTHER}}, readyToSend=false, sent=false}: INSERT INTO `door_opening` (`device` ,`start` ,`end` ,`readyToSend` ,`sent` ) VALUES (?,?,?,?,?)
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.h2.jdbc.JdbcSQLException

    Unique index or primary key violation: "CONSTRAINT_INDEX_47 ON PUBLIC.METRICS_BINARY_TYPE_DEVICE(SENSORVARIABLEID, TIMESTAMP) VALUES ( /* key:26871 */ 7, 1472052735738, null)"; SQL statement: INSERT INTO `metrics_binary_type_device` (`sensorVariableId` ,`timestamp` ,`state` ) VALUES (?,?,?) [23505-176]

    at org.h2.message.DbException.getJdbcSQLException()
  2. H2 Database Engine
    JdbcPreparedStatement.executeUpdate
    1. org.h2.message.DbException.getJdbcSQLException(DbException.java:344)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    2. org.h2.message.DbException.get(DbException.java:178)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    3. org.h2.message.DbException.get(DbException.java:154)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    4. org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:103)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    5. org.h2.index.PageBtree.find(PageBtree.java:121)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    6. org.h2.index.PageBtreeLeaf.addRow(PageBtreeLeaf.java:151)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    7. org.h2.index.PageBtreeLeaf.addRowTry(PageBtreeLeaf.java:104)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    8. org.h2.index.PageBtreeNode.addRowTry(PageBtreeNode.java:206)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    9. org.h2.index.PageBtreeNode.addRowTry(PageBtreeNode.java:206)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    10. org.h2.index.PageBtreeIndex.addRow(PageBtreeIndex.java:97)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    11. org.h2.index.PageBtreeIndex.add(PageBtreeIndex.java:88)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    12. org.h2.table.RegularTable.addRow(RegularTable.java:120)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    13. org.h2.command.dml.Insert.insertRows(Insert.java:157)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    14. org.h2.command.dml.Insert.update(Insert.java:115)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    15. org.h2.command.CommandContainer.update(CommandContainer.java:79)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    16. org.h2.command.Command.executeUpdate(Command.java:254)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    17. org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:158)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    18. org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:144)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    18 frames
  3. ORMLite JDBC
    JdbcDatabaseConnection.insert
    1. com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:170)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    1 frame
  4. ORMLite Core
    BaseDaoImpl.create
    1. com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    2. com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:450)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    3. com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:310)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    3 frames
  5. org.mycontroller.standalone
    McMessageEngine.run
    1. org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.create(BaseAbstractDaoImpl.java:184)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    2. org.mycontroller.standalone.message.McMessageEngine.recordSetTypeData(McMessageEngine.java:848)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    3. org.mycontroller.standalone.message.McMessageEngine.execute(McMessageEngine.java:116)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    4. org.mycontroller.standalone.message.McMessageEngine.run(McMessageEngine.java:962)[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    4 frames
  6. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)[na:1.8.0_65]
    1 frame