Uploaded image for project: 'LAMS Development'
  1. LAMS Development
  2. LDEV-2502

JDBC batch update error when copying forum content with conditions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.3
    • Fix Version/s: 2.4, 2.3.4
    • Component/s: Tool Forum
    • Labels:
      None

      Description

      Sometimes when a forum tool's content is copied, an exception is thrown due to LAMS trying to insert the same topic for a certain condition. This breaks the primary key constraints on the tl_lafrum11_condition_topics table:

      server.log:

      org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

      hibernatelams.log:

      2010-02-03 17:24:49,937 [http-172.20.100.18-8080-8] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000
      2010-02-03 17:24:49,937 [http-172.20.100.18-8080-8] ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '166-82' for key 'PRIMARY'
      2010-02-03 17:24:49,938 [http-172.20.100.18-8080-8] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
      org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
      ...
      Caused by: java.sql.BatchUpdateException: Duplicate entry '166-82' for key 'PRIMARY'

      mysql.log:

                         11 Query update tl_lafrum11_message set create_date='2010-02-02 10:38:13', last_reply_date='2010-02-03 17:24:49', update_date='2010-02-03 17:24:49', create_by=null, modified_by=null, subject='Topic Heading', body='Topic message', is_authored=1, is_anonymous=0, forum_session_uid=null, parent_uid=null, forum_uid=45, reply_number=0, hide_flag=0, report_id=null where uid=82
                         11 Query update tl_lafrum11_conditions set content_uid=45 where condition_id=166
                         11 Query insert into tl_lafrum11_condition_topics (condition_id, topic_uid) values (166, 82)
                         11 Query insert into tl_lafrum11_condition_topics (condition_id, topic_uid) values (166, 82)
                         11 Query rollback


      Problem is with the equals/compare implementation for the Message object in forum. They need to be consistent.

        Activity

        Hide
        ernieg Ernie Ghiglione added a comment -
        Can't replicate, so this is solved. Thanks Jun!
        Show
        ernieg Ernie Ghiglione added a comment - Can't replicate, so this is solved. Thanks Jun!

          People

          • Assignee:
            jundirl Jun-Dir Liew
            Reporter:
            jundirl Jun-Dir Liew
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development