java.sql.SQLException: 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=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:52:22, type=S_ARDUINO_NODE, libVersion=2.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1472079174284, rssi=100%|100%, properties={}, parentNodeEui=0, registrationState=REGISTERED), room=null, variableTypes=[Variable 1, Variable 2]), variableType=V_VAR2, metricType=DOUBLE, timestamp=1472079176762, value=1.0, previousValue=4.0, unitType=U_NONE, readOnly=false, offset=0.0, priority=100, graphProperties={color=#ff7f0e, interpolate=linear, subType=line, useGlobal=true, type=lineChart}), timestamp=1472079176762, samples=1, min=1.0, max=1.0, avg=1.0, aggregationType=RAW, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?)

GitHub | cimba007 | 6 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    GitHub comment 253#242234204

    GitHub | 6 months ago | cimba007
    java.sql.SQLException: 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=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:52:22, type=S_ARDUINO_NODE, libVersion=2.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1472079174284, rssi=100%|100%, properties={}, parentNodeEui=0, registrationState=REGISTERED), room=null, variableTypes=[Variable 1, Variable 2]), variableType=V_VAR2, metricType=DOUBLE, timestamp=1472079176762, value=1.0, previousValue=4.0, unitType=U_NONE, readOnly=false, offset=0.0, priority=100, graphProperties={color=#ff7f0e, interpolate=linear, subType=line, useGlobal=true, type=lineChart}), timestamp=1472079176762, samples=1, min=1.0, max=1.0, avg=1.0, aggregationType=RAW, timestampFrom=null, timestampTo=null): INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?)
  2. 0

    GitHub comment 241#239619972

    GitHub | 6 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 | 6 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

    ERROR log: Unique index or primary key violation

    GitHub | 6 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 (?,?,?)
  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_4B ON PUBLIC.METRICS_DOUBLE_TYPE_DEVICE(SENSORVARIABLEID, TIMESTAMP, AGGREGATIONTYPE) VALUES ( /* key:63298 */ 3, 1472079176762, null, null, null, null, 0)"; SQL statement: INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?) [23505-176]

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