Differences between revisions 4 and 5
Revision 4 as of 2008-12-14 10:55:16
Size: 1893
Comment:
Revision 5 as of 2009-09-20 23:20:02
Size: 1893
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

First of all, a simple example that shows this error can occur (Tapestry 5.0.17):

Imagine the following:

1. A page that shows objects to be edited inside of a Grid (EditDomains)

  • An "Edit Link" inside of the grid table that will link to another page that allows editing of the object. The "Edit Link" passes the whole object to the Edit Page.

2. The Edit Page receives the edited object and saves it.

EditDomains.tml

EditDomains.java

   1 @InjectPage
   2 private EditDomain editDomain;
   3         
   4 EditDomain onActionFromEdit(Domain domain)
   5 {
   6     editDomain.setDomain(domain);
   7     return editDomain;
   8 }

EditDomain.tml

Name
Inherit from
URL

EditDomain.java

   1 private void onSelectedFromAddDomain() {
   2 
   3                 
   4 session.updateOrUpdate(domain);

org.apache.tapestry5.runtime.ComponentEventException
a different object with the same identifier value was already associated with the session: [tm.framework.entities.Domain#6]

The Solution:

   1                 Domain temp = (Domain)session.merge(domain);
   2                 session.update(temp);

Tapestry5AvoidingDifferentObjectWithSameIDExceptions (last edited 2009-09-20 23:20:02 by localhost)