4 Replies Latest reply on Nov 23, 2006 4:40 AM by Max Ulanovsky

    Using collections of detached entities

    Max Ulanovsky Newbie

      I'm using collections of entities with multiple agregations: class Test agregates the collection of Question objects with @OneToMany annotation and each Question object agregates the collection of Answer objects. I need to send the whole test with questions and answers to the remote client, but when it recives the test I can't get access to the colections of agregated entities 'cause LazyInitializationException . I set fetch=FetchType.EAGER for collection of questions in class Test and it works, but when I've tried to do the same thing for answers I got

      org.hibernate.HibernateException: cannot simultaneously fetch multiple bags

      I'd be very glad if somebody could help me to solve this trouble