I got a strange exception. My mappings :
public class ConcreteProduct {
...
@OneToMany(mappedBy = "concreteProduct")
public Set<ExternalClient> getExternalClients() {
return externalClients;
}
....
}
public class ExternalClient {
...
@ManyToOne
@JoinColumn(name = "id_concrete_product")
public ConcreteProduct getConcreteProduct() {
return concreteProduct;
}
..
}
And I Want to make a simple operations on ConcreteProduct using Hibernate operations. I use crudDAO:
ConcreteProduct concreteProduct = (ConcreteProduct) crudDAO.getById( ConcreteProduct.class, list.get( 0 )
.getId() );
if ( concreteProduct != null ) {
finishCalculation( concreteProduct );
crudDAO.save( concreteProduct );
}
and there is an exception :
Exception in thread "Thread-33" org.springframework.orm.hibernate3.HibernateSystemException: Found two representations of same collection: pl.eo.apps.mops.product.bo.ConcreteProduct.externalClients; nested exception is org.hibernate.HibernateException: Found two representations of same collection: pl.eo.apps.mops.product.bo.ConcreteProduct.externalClients Caused by: org.hibernate.HibernateException: Found two representations of same collection: pl.eo.apps.mops.product.bo.ConcreteProduct.externalClients
Maybe important thing is that whole operation is processed within a Thread. What is causing the problem here?