org.hibernate.exception.ConstraintViolationException: could not insert: [eu.epsos.configmanager.database.model.Property]

JIRA | Kostas Karkaletsis | 4 years ago
  1. 0

    [root@ncp-b bin]# /opt/java/jdk1.6.0_21/bin/java -jar ConfigManagerMigrationTool.jar -f epsos | srdc -bash: srdc: command not found [root@ncp-b bin]# /opt/java/jdk1.6.0_21/bin/java -jar ConfigManagerMigrationTool.jar -f epsos | srdc -bash: srdc: command not found Exception in thread "main" org.hibernate.exception.ConstraintViolationException: could not insert: [eu.epsos.configmanager.database.model.Property] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2285) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2678) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) at pt.spms.epsos.main.MigrateProperties.processProperties(MigrateProperties.java:121) at pt.spms.epsos.main.MigrateProperties.main(MigrateProperties.java:84) Caused by: java.sql.BatchUpdateException: Duplicate entry '1500000' for key 1 at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2054) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2265) ... 12 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1500000' for key 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450) at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)

    JIRA | 4 years ago | Kostas Karkaletsis
    org.hibernate.exception.ConstraintViolationException: could not insert: [eu.epsos.configmanager.database.model.Property]
  2. 0

    Building Failing

    GitHub | 4 years ago | augepang
    java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`testCrux`.`mapping`, CONSTRAINT `fk_mapping_connectionId` FOREIGN KEY (`connectionId`) REFERENCES `connection` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
  3. 0

    JPA @ManyToOne - I don't want cascade delete

    Stack Overflow | 2 years ago | √Āron Nemmondommegavezet√©knevem
    org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Possible to get a named bundle that will not delete

    GitHub | 3 years ago | wezell
    com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`dotcms`.`publishing_bundle_environment`, CONSTRAINT `fk_bundle_id` FOREIGN KEY (`bundle_id`) REFERENCES `publishing_bundle` (`id`))
  6. 0

    Deleting an Environment with a server throws an error

    GitHub | 3 years ago | wezell
    com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`dotcms`.`publishing_bundle_environment`, CONSTRAINT `fk_environment_id` FOREIGN KEY (`environment_id`) REFERENCES `publishing_environment` (`id`))

  1. Kialandei 1 times, last 2 weeks ago
  2. DoktorDoener666 6 times, last 3 weeks ago
  3. mauritius 1 times, last 3 weeks ago
  4. MoYapro 1 times, last 4 weeks ago
  5. jshakil 1 times, last 1 month ago
11 more registered users
45 unregistered visitors
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. com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException

    Duplicate entry '1500000' for key 1

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0()
  2. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    4 frames
  3. MySQL jdbc
    PreparedStatement.executeBatchSerially
    1. com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    2. com.mysql.jdbc.Util.getInstance(Util.java:386)
    3. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
    4. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
    5. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
    6. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
    7. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
    8. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
    9. com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
    10. com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450)
    11. com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
    11 frames