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 
   2 @InjectPage
   3 private EditDomain editDomain;
   4         
   5 EditDomain onActionFromEdit(Domain domain)
   6 {
   7     editDomain.setDomain(domain);
   8     return editDomain;
   9 }

EditDomain.tml

Name
Inherit from
URL

EditDomain.java

   1 
   2 private void onSelectedFromAddDomain() {
   3 
   4                 
   5 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 
   2                 Domain temp = (Domain)session.merge(domain);
   3                 session.update(temp);

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