Questions Tagged With jpahttps://answers.axonivy.com/tags/jpa/?type=rss&user=joha0123questions tagged <span class="tag">jpa</span>enThu, 26 May 2016 16:59:17 -0400How can i persist a file as BLOB?https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob<p>Hi,</p> <p>i am using the primefaces fileupload widget, so users can upload attatchment files. right now, i save the files on the filesystem and i persist the path to the file in the database.</p> <p>is there a way to save files as BLOB in relational database?</p> <p>Thank you for your answers!</p>joha0123Thu, 26 May 2016 16:59:17 -0400https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blobjpafileivypersistenceAvoid MultipleBagFetchException when referencing multiple collections of another typehttps://answers.axonivy.com/questions/1745/avoid-multiplebagfetchexception-when-referencing-multiple-collections-of-another-type<p>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:</p> <pre><code>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 </code></pre> <p>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?</p> <p>the structure is: institutionList is inside education which is inside application which has the other list.</p> <p>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.</p> <p>can you show me how to do this?</p> <p>thank you very much</p>joha0123Fri, 22 Apr 2016 22:04:56 -0400https://answers.axonivy.com/questions/1745/avoid-multiplebagfetchexception-when-referencing-multiple-collections-of-another-typejpadataclasspersistenceHow can I add a List to a databasehttps://answers.axonivy.com/questions/1740/how-can-i-add-a-list-to-a-database<p>I am filling a List and then I try to write it to the database. We have two Entity Classes: Application and Education. The relationship is 1:N. (One application can have many educations)</p> <p>In the Application entity class I have created a List of Education with the relationship ONE_TO_MANY. Mapped by attribute is <strong>appl</strong>. In the Education entity class i have created a field <strong>appl</strong> with the relationship MANY_TO_ONE.</p> <p>The Problem is, that i have to initialize all objects before i can write data into them. this is impossible to do, because the application Object has a Education object in it and the Education Object has a Application object in it.</p> <p>Is there an other way to save my data to a database?</p> <p>thanks.</p>joha0123Wed, 20 Apr 2016 16:25:00 -0400https://answers.axonivy.com/questions/1740/how-can-i-add-a-list-to-a-databasejpadataclassivypersistence