0

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?

Dawid
  • 644
  • 1
  • 14
  • 30
  • the finishCalculation() method is not important, if I delete this line of my code the exception also occurs – Dawid Jun 14 '12 at 10:45
  • Could this be a problem you are facing http://stackoverflow.com/questions/2956171/jpa-2-0-ordercolumn-annotation-in-hibernate-3-5/3480336#3480336 ? – d1e Jun 14 '12 at 10:48
  • unfortunately no, there is not a single place in my application with OrderColumn annotation – Dawid Jun 14 '12 at 10:49
  • 1
    I'm gonna try to remove the "mapped by" element and see if it works – Dawid Jun 14 '12 at 10:54
  • 1
    Unfortunately this didn't help – Dawid Jun 14 '12 at 11:11
  • @Dawid I know this is an old post, but have you found any solution? I may be facing the same problem. – riddle_me_this Aug 23 '14 at 23:44
  • @bphilipnyc to be honest I don't remember. It was a long time ago and soon after that I switched to Rails – Dawid Aug 26 '14 at 06:19

0 Answers0