Sunday, March 09, 2008

JPA Error : org.hibernate.HibernateException: cannot simultaneously fetch multiple bags

Apparently JPA has a problem with @OneToMany(fetch=FetchType.EAGER) relationships. Above error seems to occur whenever there is a multiple of such relationships in a class. BUT I had a problem where even a single relationship gave this error. The funny bit is that I had NO problems till I needed to add a new persistant class, thats when this guy popped up. Before that I DID HAVE MULTIPLE @OneToMany(fetch=FetchType.EAGER) relationships and it worked perfectly!

Frustrations!

Morale of the story : Don'y be lazy! Cut down @OneToMany(fetch=FetchType.EAGER) relationships. Anyways, I don't think its THAT efficient anyways

No comments: