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)

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)