Bug 1116705 - Unable to alter saved search filter fields
Summary: Unable to alter saved search filter fields
Alias: None
Product: PressGang CCMS
Classification: Community
Component: Web-UI
Version: 1.7
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 1.9
Assignee: Lee Newson
QA Contact:
: 1124577 1124578 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2014-07-07 06:00 UTC by Lee Newson
Modified: 2014-09-01 01:20 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-09-01 01:20:34 UTC

Attachments (Terms of Use)

Description Lee Newson 2014-07-07 06:00:03 UTC
Attempting to alter the same filter field value ends up with an error such as:

Caused by: org.mariadb.jdbc.internal.common.QueryException: Duplicate entry 'topicIds-92' for key 'index3'
	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:934)
	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:983)
	at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:280)

Attempting to remove the old field and add a new one, throws the following error:

15:55:40,059 ERROR [org.hibernate.AssertionFailure] (http-/ HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): org.hibernate.HibernateException: Could not determine type of dynamic map entity

Comment 3 Lee Newson 2014-07-08 02:52:16 UTC
The problem looks to be the order that hibernate executes the statements. It will always do inserts before deletes, see:


Comment 4 Lee Newson 2014-07-08 03:12:40 UTC
Looks like you can't make MySQL/MariaDB do deferred constraint checks either (see http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html).

As such we'll likely need to reorder how REST updates are done so that delete statements are done, flushed and then the rest of the content is inserted/updated.

Comment 6 Lee Newson 2014-07-29 06:32:55 UTC
Fixed in 1.9-SNAPSHOT build 201407291548

The core way rest entities were synced with database entities has been re-written so that it is done in stages based on the required action. This allows us to do the deletes first, flush the changes and then do the create/update operations. As such the way it works now is:

1. Collect any change information.
2. Perform the deletions on the children entities, if there are any.
3. Flush the deletions.
4. Create any new entities, syncing only the base information.
5. Update any information and perform the additional sync processing (ie XML formatting)

Note: This version has been deployed to the development/test server.

Note 2: These changes haven't been merged with devel and are currently in the BZ#1116705 branch.

Comment 7 Matthew Casperson 2014-07-29 20:44:05 UTC
Created a filter, populated all the fields, saved it, loaded it again, edited or deleted all the field and saved again ok.

I also tested adding and removing values and relationships in entities like topics, content specs, images, files, property tags, property tag categories, tags, projects and categories. There were two bugs that I found. They are probably not related to this, but I'll list there here anyway:


In any case the original bug is verified.

Comment 8 Lee Newson 2014-07-29 22:52:07 UTC
*** Bug 1124577 has been marked as a duplicate of this bug. ***

Comment 9 Lee Newson 2014-07-29 22:57:21 UTC
Moving back to ASSIGNED because of BZ#1124577

Comment 10 Lee Newson 2014-07-29 23:09:14 UTC
*** Bug 1124578 has been marked as a duplicate of this bug. ***

Comment 11 Lee Newson 2014-07-29 23:21:20 UTC
Fixed the above two issues in 1.9-SNAPSHOT build 201407300910 since they were caused by this change.

Note: This version is currently live on the test/development server.

Comment 12 Matthew Casperson 2014-07-30 01:56:56 UTC
Verified that I can now add and remove tags from categories without any errors.

Comment 13 Lee Newson 2014-07-30 02:40:45 UTC
Merged the changes into the devel branch.

Note You need to log in before you can comment on or make changes to this bug.