Has anyone ever found a good way of handling updates between DTOs and DOs when you have collections involved that does not lead to the issue of having two objects with the same identifier in a session.
The only sollution I could find is to issue a retainAll on the collection passing the list of DOs converted from the DTOs and them manually add the new ones and update the existing ones. This way I get rid of the elements that have already been removed from the collection and add/update the new ones. The problem is that this updating code is repetitive and error prone.
Has anyone ever found a better way for handling such situations?
I faced this problem while doing a project using GWT and Hibernate (the project is hosted on SF.net
http://sf.net/projects/cooperweb).
I was trying to find out if there is another solution that poses less effort and less chance of errors.
regards,
Rafael Ribeiro