History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: TRAILS-78
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Alejandro Scandroli
Reporter: Alejandro Scandroli
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Trails

Editing a child object from a indexed list "child" collection creates duplicates.

Created: 02/Jul/07 10:45 AM   Updated: 03/Sep/07 12:54 PM
Component/s: trails-core, trails-hibernate
Affects Version/s: None
Fix Version/s: 1.1.0

Time Tracking:
Not Specified


 Description  « Hide
If the child collection is an indexed list when you edit a child object and go back to its parent the object gets added to the list twice, in fact is more than twice, it gets added to the list every time you edit it.

This bug does not affect Trails 1.0 or Sets, and if you are using a non indexed list the bug may not seem too big.

To see the bug in action, lunch the "simple" example, edit a catalog and then add categories to it.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Alejandro Scandroli - 02/Jul/07 03:39 PM
a workaround (from the user's point of view) is to use an "add" method
public void addCategory (Category category) {
		if (!getCategories().contains(category)) {
			getCategories().add(category);
		}
	}

Trails will automagically detect that this method exists and it will use it for adding child objects to the collection.


Alejandro Scandroli - 03/Sep/07 12:54 PM
fixed in svn rev 739