Error Org Hibernate Util Jdbcexceptionreporter Duplicate Entry For Key Primary
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow sql error 1062 sqlstate 23000 hibernate the company Business Learn more about hiring developers or posting ads with us Stack
Mysql Sql Error: 1062, Sqlstate: 23000
Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Hibernate Duplicate Entry For Key 'primary'
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up org.hibernate.util.JDBCExceptionReporter] Duplicate entry X for key 'PRIMARY' up vote 0 down vote favorite I am writing a back-end java code with active-mq in producer consumer model. When multiple consumers runs using and try to update in a table question the following exception is occured and the transaction is rollbacked. Multiple threads are running inside each consumer task. WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000 07:10:31,609 ERROR [org.hibernate.util.JDBCExceptionReporter] Duplicate entry '69-947' for key 'PRIMARY' 07:10:31,615 ERROR [com.xminds.bestfriend.consumers.QuestionGeneration] Exception failed the Question generation org.springframework.dao.DataIntegrityViolationException: could not insert: [com.xminds.bestfriend.frontend.model.Friendship]; Any one can suggest a solution for this. java multithreading activemq share|improve this question edited Jul 23 '13 at 9:09 Peter Butkovic 3,64012147 asked Jul 23 '13 at 7:03 Vishnupriya 5139 2 Duplicate entry '69-947' for key 'PRIMARY' , it seems two threads are trying to insert a record with same PK ! How do you generate the PK ? –NINCOMPOOP Jul 23 '13 at 7:05 I am taking stream data from facebook for our application and inside the table post_id is used as primary key. –Vishnupriya Jul 23 '13 at 7:11 I want to know who generates the PK ? Is it auto generated or you provide the PK ? –NINCOMPOOP Jul 23 '13 at 7:14 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote I think your are trying to insert the record using existing primary key. Make sure the primary key is unique. share|improve this answer answered Jul 23 '13 at 7:05 Veera 616716 add a comment| up vote 0 down vote You have a constraint in your database. Primary key in a table is duplicate, you should use an autogenerate id for your table share|improve this answer answered Jul 23 '13 at 7:06 Sergio Puas 1666 Facebook post_id is used a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions http://stackoverflow.com/questions/17803470/org-hibernate-util-jdbcexceptionreporter-duplicate-entry-x-for-key-primary Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Hibernate Duplicate entry '7090' for key http://stackoverflow.com/questions/15759348/hibernate-duplicate-entry-7090-for-key-primary 'PRIMARY' up vote 2 down vote favorite Im getting following error when the application tries to insert a record row in the db. SQL Error: 1062, SQLState: 23000 ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '7089' for key 'PRIMARY' ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session Caused by: java.sql.BatchUpdateException: Duplicate entry '7090' for key 'PRIMARY' at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1269) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:955) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242) The definition is @Id @Column(name = "CST_CUSTOMER_ID_PK") @GenericGenerator(name = "generator", strategy = "increment") @GeneratedValue(generator = "generator") public Long getId() { return id; } public void setId(Long id) { this.id = id; } The part at which the error occurs is : savedCustomer = customerDao.save(customer); mtmrsLogger.debug("saved customer id:" + savedCustomer.getId()); /** * Updating Customer Trans Table */ updateCustomerTransForMakerChecker(customer, customerform.getAuditDetails()); /** * Updating Customer Audit */ updateCustomerAuditForMakerChecker(customer, customerform.getAuditDet
This Site Careers Other all forums Forum: Object https://coderanch.com/t/513185/ORM/databases/SEVERE-Duplicate-entry-key-PRIMARY Relational Mapping SEVERE: Duplicate entry '1' for key 'PRIMARY' shankhas sanyal Ranch Hand Posts: 45 posted 6 years ago http://jira.xwiki.org/browse/XWIKI-13336?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab hi all, I am very new to hibernate and I am following a simple one to many example that I duplicate entry found on "Vaannila.com". these are my tables : DROP TABLE IF EXISTS `phone`; CREATE TABLE `phone` ( `phone_id` bigint(255) NOT NULL AUTO_INCREMENT, `phone_type` varchar(255) DEFAULT NULL, `phone_number` varbinary(255) DEFAULT NULL, PRIMARY KEY (`phone_id`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1; /*Table duplicate entry for structure for table `student` */ DROP TABLE IF EXISTS `student`; CREATE TABLE `student` ( `student_id` bigint(255) NOT NULL AUTO_INCREMENT, `student_name` varbinary(255) NOT NULL, PRIMARY KEY (`student_id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; /*Table structure for table `student_phone` */ DROP TABLE IF EXISTS `student_phone`; CREATE TABLE `student_phone` ( `student_id` bigint(255) NOT NULL AUTO_INCREMENT, `phone_id` bigint(255) DEFAULT NULL, PRIMARY KEY (`student_id`), KEY `FK_student_phone1` (`phone_id`), CONSTRAINT `FK_student_phone1` FOREIGN KEY (`phone_id`) REFERENCES `phone` (`phone_id`), CONSTRAINT `FK_student_phone` FOREIGN KEY (`student_id`) REFERENCES `student` (`student_id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; my hibernate.cfg.xml this issue! ExportXMLWordPrintable Details Type: Bug Status: Open Priority: Critical Resolution: Unresolved Affects Version/s: 7.4.2, 8.1 Fix Version/s: None Component/s: Attachments Labels: None Environment: Tomcat 7 on 64 bits MySQL 5.7 Java 8 Windows 8.1 Pro on 64 bits / Windows 10 Chrome 49/ 51 Difficulty: Unknown Similar issues: XWIKI-13383Editing and Rollbacking caused a duplicate primary key errorXWIKI-7981R40001XWIKI7540DataMigration fails on duplicate entryXWIKI-7791IDs of stats objects are not properly computed and cause duplicated primary key issues during migration to 4.0XWIKI-8518Duplicate primary key in xwikircs during document save (race condition ?)XWIKI-1434Case Related Issue With BacklinksXWIKI-6170Cache incoherency caused by duplication of documents in the cache.XWIKI-7057Database error when saving a document with twice the same link but with different caseXWIKI-13533Cannot save a non-terminal page in the same space in a specific use caseXWIKI-13214"My Recent Modifications" Panel show duplicate entries (again)XWIKI-12413LDAP Group Sync makes extra queries when duplicated member entry is a user Description Tested and reproduced on XE 7.4.2 Before testing, you must have these configurations: Set Maximum Upload Size to 1073741824 by editing XWiki.XWikiPreferences in Object mode Set max_allow_packet to 1073741824 bytes (1073 MB) inside MySQL Set -Xmx2g inside Tomcat. 1. Login with Admin and create a page. 2. In this bug you will find the files I`ve tested with. 2. Attach to this page files xls,pdf, sql, mp3 . 3. While they are loading, attach quick the png. 4. Now, attach quick again all files xls,pdf, sql, mp3, png. 5. Wait some minutes to finish loading and check the state of each attachment. 6. Check also tomcat logs. Actual result: The upload of some files will crash and will generate in the bottom of the page this error: "An error has occurred while uploading document..." If you check the tomcat logs, you will find: WARN o.h.u.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000 ERROR o.h.u.JDBCExceptionReporter - Duplicate entry '1610061