<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Avoid MultipleBagFetchException when referencing multiple collections of another type</title><link>https://answers.axonivy.com/questions/1745/avoid-multiplebagfetchexception-when-referencing-multiple-collections-of-another-type</link><description>&lt;p&gt;I know how to store  a single list in a JPA class. but now everytime i try to add another list to any other entity class i get an ivy:error:persistence, with following error message:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IvyScriptRuntimeException: IvyScript Runtime Exception in
    Instruction:
        ivy.persistence.axsosUnit.findAll(teamprojekt.Job.class)
    Block:
        teamprojekt.showDashboard.showDashboardData out;
        out = in;
        in.data.closedJobs = ivy.persistence.axsosUnit.findAll(teamprojekt.Job.class);

IvyScriptMethodInvocationException: Error calling method findAll(java.lang.Class) on an object of class ch.ivyteam.ivy.process.data.persistence.internal.IvyEntityManager.

PersistenceUnitException: Failed to excecute operation "findAll" for persistence unit "axsosUnit".

PersistenceUnitException: Could not create EntityManagerFactory of persistence unit'axsosUnit'

PersistenceException: [PersistenceUnit: axsosUnit] Unable to build EntityManagerFactory

MultipleBagFetchException: cannot simultaneously fetch multiple bags
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have read, that you cant use two lists in the same entity class, but i use them in different entity classes. maybe because they are nested?&lt;/p&gt;
&lt;p&gt;the structure is: 
institutionList is inside education which is inside application which has the other list.&lt;/p&gt;
&lt;p&gt;I have also read, the solution is to use a set instead of a list. can you explain how to do this?
I've tried to change the list to  a set from the entity class wizzard, but without success.&lt;/p&gt;
&lt;p&gt;can you show me how to do this?&lt;/p&gt;
&lt;p&gt;thank you very much&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1745/avoid-multiplebagfetchexception-when-referencing-multiple-collections-of-another-type" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 25 Apr 2016 09:35:02 -0400</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/1745/avoid-multiplebagfetchexception-when-referencing-multiple-collections-of-another-type/1747</link><description>&lt;p&gt;Just go into the dataclass editor and write the new set type into the column 'Type'. &lt;/p&gt;
&lt;p&gt;In my &lt;a href="/upfiles/simpleJpa_51.iar"&gt;example project&lt;/a&gt; it would be be &lt;code&gt;java.util.Set&amp;lt;simpleJpa.Phone&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/jpaSetField.png"&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Mon, 25 Apr 2016 09:35:02 -0400</pubDate><guid>https://answers.axonivy.com/questions/1745/avoid-multiplebagfetchexception-when-referencing-multiple-collections-of-another-type/1747</guid></item></channel></rss>