Questions Tagged With persistencehttps://answers.axonivy.com/tags/persistence/?type=rssquestions tagged <span class="tag">persistence</span>enThu, 05 Dec 2019 10:48:10 -0500Park Task not saving datahttps://answers.axonivy.com/questions/4239/park-task-not-saving-data<p>Basically, the Park Task feature is as far as I know intended to let the user continue his work later. However, I'm currently facing the issue that none of the data is persisted, when I park the task in the Designer (7.2.1).</p> <p>I'm having one logic step, called <code>save</code> which contains the following script steps:</p> <pre><code>ivy.session.parkTask(ivy.task); for(int i = 0; i&lt;in.data.filesOnDisk.size(); i++) { FileHelper.deleteFolder(in.data.filesOnDisk.get(i).getAbsolutePath()); } </code></pre> <p>And a simple faces redirect to the portal start. Is there any better way to save/persist data while being in a task without using another database as stated in <a href="https://answers.axonivy.com/questions/1017/save-task-data-while-in-task">this topic</a>?</p> <p>Did I misunderstand the function of <code>parkTask</code>?</p>maio290Thu, 05 Dec 2019 10:48:10 -0500https://answers.axonivy.com/questions/4239/park-task-not-saving-datataskpersistenceNoSQL In Axon.Ivyhttps://answers.axonivy.com/questions/4124/nosql-in-axon-ivy<p>Hello, Has anybody had any experiences with Axon.Ivy and NoSQL databases(namely, MongoDB) ? And if so, how did they approach it and what were the benefits/downsides of using NoSQL with Axon.Ivy.</p> <p>I know that Axon.Ivy Has some NoSQL functionality in it, but we are considering to use a more robust external database rather than relying on the internal one. </p> <p>For context, I have some experience in NoSQL and java, Namely in MongoDB using the Jongo driver. Anybody who has done java implementations is also welcome to share their knowledge.</p>TareqKFri, 25 Oct 2019 14:17:17 -0400https://answers.axonivy.com/questions/4124/nosql-in-axon-ivypersistencedatabaseHow to persist fields in ivy repo but not index in elastic?https://answers.axonivy.com/questions/4010/how-to-persist-fields-in-ivy-repo-but-not-index-in-elastic<p>For some projects it is interesting to store all data including files to the database so we can run such instances in docker and share the database. This way it would be possible to store the data in the business repo, even as we seen in <a href="https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob">https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob</a> it is not always efficient. But we would not need to index the base64 conent of the file in elastic. Is it possible?</p>adamfTue, 24 Sep 2019 02:58:44 -0400https://answers.axonivy.com/questions/4010/how-to-persist-fields-in-ivy-repo-but-not-index-in-elasticfilebusiness-dataelasticsearchpersistencerepositoryHow can i save bytearrays via the entityclass in a database?https://answers.axonivy.com/questions/3478/how-can-i-save-bytearrays-via-the-entityclass-in-a-database<p>Hello,</p> <p>I am trying to set up an entityclass with a postgres server. I need this database to store some images i upload with the primefaces <code>&amp;lt; p:fileUpload/&gt;</code> tag. With this tag the images are uploaded as a <code>UploadedFile</code>, now I can access the contents via <code>getContents()</code> and I will get the image as a Bytearray (byte[] in Java) . </p> <p>Now I need to know how can i save this Byte Array via the entityclasses in my postgres database. Postgres allows the datatype <code>bytea</code> for a column for this datatype, but if I add Bytearray as a type for the column in the entityclass AxonIvy throws this error: <code>The field type 'Binary' does not support persistence</code>. </p> <p>So my question is:<br> Is there any possibility i can save bytearray or blobs on my postgres server via the entity class?<br> What are all the classes which <strong>support</strong> <em>persistence</em>?</p> <p>Thanks</p>markusinhoThu, 11 Oct 2018 11:00:01 -0400https://answers.axonivy.com/questions/3478/how-can-i-save-bytearrays-via-the-entityclass-in-a-databasefileuploadpersistencedatabaseEntityNotFoundException: Unable to findhttps://answers.axonivy.com/questions/3151/entitynotfoundexception-unable-to-find<p>Hi Q&amp;A-Team,</p> <p>we are having an exception while trying to merge an entity : javax.persistence.EntityNotFoundException: Unable to find differenzmeldung.Differenz with id 51 the entity was saved in first step using ivy.persistence but the next step we have to remove to old list of sub entities and one of them had the id 51 but after merging again the exception occures.</p> <p>can you please provide us with an example about creating an entity with associations and how to update and remove them?</p> <p>best regards,</p>Spfl_Mon, 26 Mar 2018 10:25:58 -0400https://answers.axonivy.com/questions/3151/entitynotfoundexception-unable-to-findivypersistencePersistent object has been deletedhttps://answers.axonivy.com/questions/2789/persistent-object-has-been-deleted<p>hi all</p> <p>Sometime i got this exception on ivy (both engine and designer) then it's gone somehow after restarting service. Here is stacktrace:</p> <pre><code>[errorId=15D9BD0669682681, request=Ulc over HTTP POST , session=9 (ivy), application=0, requestId=7789, executionContext=SYSTEM, pmv=System$Administration$1, client=192.168.72.196] Caused by: ch.ivyteam.ivy.persistence.PersistentObjectDeletedException: Persistent object has been deleted [class=class ch.ivyteam.ivy.application.internal.data.ProcessModelData, id=5011] at ch.ivyteam.ivy.persistence.base.AbstractPersistentObjectHandle.getObject(AbstractPersistentObjectHandle.java:102) at ch.ivyteam.ivy.persistence.base.AbstractPersistentObjectHandle.getObject(AbstractPersistentObjectHandle.java:78) at ch.ivyteam.ivy.persistence.client.PersistentClientObject.getData(PersistentClientObject.java:64) at ch.ivyteam.ivy.persistence.client.PersistentClientObject$1.execute(PersistentClientObject.java:51) at ch.ivyteam.ivy.persistence.client.PersistentClientObject$1.execute(PersistentClientObject.java:1) at ch.ivyteam.ivy.persistence.base.AbstractPersistencyService.execute(AbstractPersistencyService.java:177) at ch.ivyteam.ivy.persistence.base.ClassPersistencyService.execute(ClassPersistencyService.java:673) at ch.ivyteam.ivy.persistence.client.PersistentClientObjectInternal.execute(PersistentClientObjectInternal.java:143) at ch.ivyteam.ivy.persistence.client.PersistentClientObject.execute(PersistentClientObject.java:1) at ch.ivyteam.ivy.persistence.client.PersistentClientObjectWithLongKey.execute(PersistentClientObjectWithLongKey.java:1) at ch.ivyteam.ivy.persistence.client.PersistentClientObject.getData(PersistentClientObject.java:44) at ch.ivyteam.ivy.application.internal.ProcessModel.getName_aroundBody0(ProcessModel.java:62) at ch.ivyteam.ivy.application.internal.ProcessModel.getName_aroundBody1$advice(ProcessModel.java:34) at ch.ivyteam.ivy.application.internal.ProcessModel.getName(ProcessModel.java:1) at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73) ... 172 more </code></pre> <p>Does anybody has experience on it? (Env: Ivy 6.3, PosgreSQL, Linux)</p> <p>Thanks</p>trungdvMon, 31 Jul 2017 23:30:30 -0400https://answers.axonivy.com/questions/2789/persistent-object-has-been-deletedenginepersistenceIvy data class persistence: Make the java class’s attribute transient?https://answers.axonivy.com/questions/2238/ivy-data-class-persistence-make-the-java-class-s-attribute-transient<p>Hi all,</p> <p>An employee instance will be persisted (Persistent column is yes) in ivy process. Employee java class has a list of profiles but I want to persist the profiles' id instead of profiles and load profiles when call getProfiles() if profiles attribute is null.</p> <p>Do you have any solutions/suggestions?</p> <p>Thank you.</p> <p>Long Do</p>dolongThu, 01 Dec 2016 10:59:01 -0500https://answers.axonivy.com/questions/2238/ivy-data-class-persistence-make-the-java-class-s-attribute-transientivypersistenceIs there a way to use some kind of semaphore in ivy?https://answers.axonivy.com/questions/2184/is-there-a-way-to-use-some-kind-of-semaphore-in-ivy<p>I have the situation that I have a database call which gives me a list of elements. Some activities later I write down the modified elements to the db. This is working fine als long as I don't have parallelism. The problem is that the second db operation potentially affects the first db operation. If now two tasks arrive at the first element and read from the database before one task has written the result to the db I get a wrong result. The solution would be to prevent the second task entering the first database read until the first task has written down the result.</p> <p>Do we have some kind of support for such cases?</p>ruffzyMon, 14 Nov 2016 20:58:27 -0500https://answers.axonivy.com/questions/2184/is-there-a-way-to-use-some-kind-of-semaphore-in-ivybest-practicepersistencethreadWhat does "@Ref-x" mean in BusinessDataRepository (persistence) ?https://answers.axonivy.com/questions/2155/what-does-ref-x-mean-in-businessdatarepository-persistence<p>Hi ivyteam</p> <p>Here i have an example about record on Ivy database (it's JSON) <img alt="alt text" src="http://answers.axonivy.com/upfiles/Untitled_C81Puuf.png"></p> <p>the <code>@id</code> is generated id of persistence but what is the meaning behind of its value? ex: <code>$Ref-0</code>, <code>$Ref-1</code>,... Thanks</p>trungdvWed, 02 Nov 2016 08:53:59 -0400https://answers.axonivy.com/questions/2155/what-does-ref-x-mean-in-businessdatarepository-persistenceaxon.ivypersistencenvarchar(max)https://answers.axonivy.com/questions/1988/nvarchar-max<p>Hi All,</p> <p>What is the recommendation for having column like nvarchar(max) ? what should I put in the Length value in the designer when creating Entities nvarchar(max) ? 2147483647 maybe ?</p> <p>Best Regards, Yordan</p>Stelt0Wed, 24 Aug 2016 16:31:53 -0400https://answers.axonivy.com/questions/1988/nvarchar-maxhibernateentity-managerpersistenceEntity Class Migrationshttps://answers.axonivy.com/questions/1872/entity-class-migrations<p>Hello Guys,</p> <p>I`m new to Hibernate and JPA. I have an Axon.Ivy project that has couple of Entity Classes. I want to move them in a separate project and separate namespace(package) and also to add some additional fields.</p> <p>What are the implications when I`m changing the data model and the namespaces ? How do I migrate the changes to the production server ?</p> <p>In .Net Entity Framework there is a concept of 'migrations' where the changes to the database are applied automatically when the code is deploys.</p> <p>Best Regards, Yordan Yunchov</p>Stelt0Wed, 06 Jul 2016 10:08:37 -0400https://answers.axonivy.com/questions/1872/entity-class-migrationsdataclassmigrationpersistenceHow 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-blobjpafileivypersistenceWhy does Axon.ivy persist an ICase when `setAdditionalProperty` is invoked even if there is no TaskSwitch element?https://answers.axonivy.com/questions/1755/why-does-axon-ivy-persist-an-icase-when-setadditionalproperty-is-invoked-even-if-there-is-no-taskswitch-element<p>There written in the <a href="http://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.concepts.html#ivy-wf-states">public document</a>:</p> <blockquote> <p>Normally, a case is started non persistent. This means it is stored in memory only. As soon as the process hits a task switch the case and its tasks will be made persistent by storing them to the system database.</p> </blockquote> <p>I just found out that you can make an ICase persisted without any TaskSwitch element in the process by setting an <code>additionalProperty</code>.</p> <p>As soon as the line of code is evaluated:</p> <pre><code>ivy.case.setAdditionalProperty("anything-will-do", "some-value"); </code></pre> <p>The <code>ICase</code> will be persisted <em>immediately</em>.</p> <p>Is this a non-public behaviour or a bug in the API?</p> <p>P.S: there is a demo project to demonstrate this behaviour at <a href="https://www.mediafire.com/?hxi3z0v27dhjxh4">https://www.mediafire.com/?hxi3z0v27dhjxh4</a></p>Genzer HawkerFri, 29 Apr 2016 05:40:29 -0400https://answers.axonivy.com/questions/1755/why-does-axon-ivy-persist-an-icase-when-setadditionalproperty-is-invoked-even-if-there-is-no-taskswitch-elementcaseadditional-propertypersistenceworkflowAvoid 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-databasejpadataclassivypersistenceUse of Connection Poolhttps://answers.axonivy.com/questions/1677/use-of-connection-pool<p>Hi</p> <p>Is it possible to use the connection pool from ivy in a Java class?</p> <p>I currently reading the database configuration with : <code> Ivy.wfCase().getApplication().findExternalDatabaseConfiguration("myDB") </code></p> <p>and open the configuration with: <code> ch.ivyteam.db.jdbc.DatabaseUtil.openConnection(dbConf) ch.ivyteam.db.jdbc.DatabaseUtil.DatabaseUtil.closeConnection(conn); </code></p> <p>With this approach it doesn't use the pooled connections like in an ivy database step.</p>MichaelThu, 10 Mar 2016 09:17:17 -0500https://answers.axonivy.com/questions/1677/use-of-connection-poolconfigurationjavapersistenceHow to delete a dependent persistence object?https://answers.axonivy.com/questions/1371/how-to-delete-a-dependent-persistence-object<p>We have a persistence object A which has a property <code>List(Object b)</code>.</p> <p>When we remove one object b from the list with:</p> <pre><code>out.questionnaireConcept.QuestionnaireConceptParticpants.remove(in.participantToRemove); </code></pre> <p>and then try to persist this with:</p> <pre><code>ivy.persistence.***MuPersistence.merge(in.questionnaireConcept); </code></pre> <p>The participant which we tried to remove is still present in the database. I thought this could be set within the persistence definition in this window:</p> <p><img alt="alt text" src="http://answers.axonivy.com/upfiles/Unbenannt_6vIaC2d.PNG"></p> <p>Do we have to remove the object b separately from the database or how can we achieve this?</p>Nikel WeisThu, 18 Jun 2015 14:11:26 -0400https://answers.axonivy.com/questions/1371/how-to-delete-a-dependent-persistence-objectpersistenceHow to work with NULL-Values in DateTime-Types using persistence?https://answers.axonivy.com/questions/1369/how-to-work-with-null-values-in-datetime-types-using-persistence<p>We are facing the following problem: We are using the persistence-feature to handle complex objects. During the fetch we get values where a datetime-field is not set (NULL in the database) - when we try to write the entity object instance back to the database (merge) we get the following exception:</p> <pre><code>"SQLException: Only dates between January 1, 1753 and December 31, 9999 are accepted. DataException: could not update: [de.*****.qia.persistence.QuestionnaireQuestion#130] PersistenceException: org.hibernate.exception.DataException: could not update: [de.*****.qia.persistence.QuestionnaireQuestion#130] RollbackException: Error while committing the transaction Failed to excecute operation "merge" for persistence unit "qiaPersistence". </code></pre> <p>The reason is quite obvious - the auto-initialized value is out of the allowed range for the MSSQL-Server. But shouldn't NULL be the value to be written back?</p> <p>How can we adress this? A workaround would be to enforce that a date is created during the initial persist but there could be situation where "NULL" is programmtically a valid entry.</p> <p>How can we adress this issue?</p> <p>Edit: RDBMS: MSSQL Express 2008</p>Nikel WeisWed, 17 Jun 2015 11:45:23 -0400https://answers.axonivy.com/questions/1369/how-to-work-with-null-values-in-datetime-types-using-persistencepersistenceWhich data-type can we use to save a file to a database using the IvyPersistence?https://answers.axonivy.com/questions/1336/which-data-type-can-we-use-to-save-a-file-to-a-database-using-the-ivypersistence<p>Currently we are trying to write a file to the database using Ivy's persistence API - which data-type can we use to achieve this or do we have to use a plain SQL-Step?</p>Nikel WeisTue, 26 May 2015 12:15:02 -0400https://answers.axonivy.com/questions/1336/which-data-type-can-we-use-to-save-a-file-to-a-database-using-the-ivypersistencepersistenceHow IvyEntityManager hanldes transaction of persistence?https://answers.axonivy.com/questions/1244/how-ivyentitymanager-hanldes-transaction-of-persistence<p>My current project have 8 modules, it will deploy 8 Process Model Versions in Ivy Application, I set maximum connection of database is 5. But when I run my app, it created more than 5 so it make my app stopped, when I increased number of connection, It worked normally, and I saw it created 8 connections. Why?</p> <p>I am using IvyEntityManager to control transaction of entities. The problem is Ivy opened connection and retain it, not closes after I do operations(e.g merge...). So what IvyEntityManage does?</p>Thanh CongThu, 02 Apr 2015 09:57:10 -0400https://answers.axonivy.com/questions/1244/how-ivyentitymanager-hanldes-transaction-of-persistencepersistenceAdding additional Libraries to Hibernate, e.g. Envershttps://answers.axonivy.com/questions/1138/adding-additional-libraries-to-hibernate-e-g-envers<p>Hello Ivy-Developers!</p> <p>Envers is a powerfull Library, that comes along with the Hibernate-Package and allows auto-Auditing for entities. (History-Tables etc.)</p> <p>Update:</p> <p>To insert the library I did as following: Added hibernate-envers-4.2.13.Final.jar to ivy-Hibernate-jar:</p> <p>designer\plugins\ch.ivyteam.hibernate_5.1.0.201409121008.jar\lib\mvn\</p> <p>made some changes in the ivy-Hibernate-jar: ',lib/mvn/hibernate-envers-4.2.13.Final.jar' added to MANIFEST.MF</p> <p>in pom.xml I inserted a new dependency for hibernate-envers (see pom.xml)</p> <p>When inserting this library this unusual way, there are no more errors accessing the persistence.</p> <p>Adding @Audited to the Entity gives no error, but no auditing happens on merge.(Wich would usualy be the case)</p> <p>Merging through the EntityManager (from createEntityManager()) does not work (Nothing happens, no error)</p> <p>Trying to access the AuditReader will fail on a ClassNotFoundException: org.hibernate.envers.AuditReaderFactory</p> <pre><code>// switching contextClassLoader to ivy.request.getProject().getProjectClassLoader() EntityManager em = entityManager.createEntityManager(); AuditReaderFactory.get(em); </code></pre> <p>As I understand this has been successfully implemented in the csc project.</p> <p>So the questions are: How can I integrate this library into Ivy? If not possible, is there a way to detach Hibernate more from Ivy?</p> <p>Installation as described in: <a href="http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch15.html">Guide from Hibernate</a> </p> <p>Thanks in advance!</p> <p>Greetings Alexis</p>AlexisTue, 27 Jan 2015 17:05:26 -0500https://answers.axonivy.com/questions/1138/adding-additional-libraries-to-hibernate-e-g-envershibernatepersistencePersistence Api - Catching NoResultExceptionhttps://answers.axonivy.com/questions/1049/persistence-api-catching-noresultexception<p>Hello</p> <p>How do I catch a NoResultException after calling the getSingleResult() on a custom query, wich often doesn't return any result. Catching the NoResultException still logs an error (<strong>NoResultException: No entity found for query</strong>) and after that the Info is printed out. Happens both in the designer and on the server.</p> <pre><code>catch (NoResultException e) { Ivy.log().info("No Result has been found for Debitor '"+number+"'."); } </code></pre> <p>haven't tested yet with other Exceptions like NonUniqueResultException.</p> <p>Thank you in advance</p>AlexisTue, 25 Nov 2014 16:35:41 -0500https://answers.axonivy.com/questions/1049/persistence-api-catching-noresultexceptionpersistenceComposite Primary Key in Persistencehttps://answers.axonivy.com/questions/1039/composite-primary-key-in-persistence<p>Hi</p> <p>Is there any way to have multiple ID's in one Entity? Corresponding JPA it should be possible. But trying in the designer I get: Exaclty one 'Id' field per Entity Class must be used. Although it is not named 'Id'. Would be saving a lot of work, when this is enabled.</p> <p>Best Regards</p> <p>Alexis</p>AlexisTue, 18 Nov 2014 15:00:16 -0500https://answers.axonivy.com/questions/1039/composite-primary-key-in-persistencepersistenceNot visible Interface on persistence queryhttps://answers.axonivy.com/questions/945/not-visible-interface-on-persistence-query<p>Calling a query on a table with BLOBs (Files in Tables) using the jTDS-Driver I get a class-loader error:</p> <p><code>java.lang.IllegalArgumentException: interface org.hibernate.engine.jdbc.WrappedBlob is not visible from class loader</code></p> <p>My Solution was to switch to an other classloader:</p> <pre><code> public synchronized void method() { Thread thread = Thread.currentThread(); ClassLoader tempLoader = thread.getContextClassLoader(); thread.setContextClassLoader(null); entityManager.createNativeQuery("select * from TSRPTBLB where TSBID = 1 ") .getSingleResult(); thread.setContextClassLoader(tempLoader); } </code></pre> <p>Will there be any other, cleaner way than switsching the classloader?</p> <p>Thank you in advance</p>AlexisTue, 09 Sep 2014 14:41:36 -0400https://answers.axonivy.com/questions/945/not-visible-interface-on-persistence-queryjavaivypersistenceWhy can I only have one field of the type List in my entity class?https://answers.axonivy.com/questions/912/why-can-i-only-have-one-field-of-the-type-list-in-my-entity-class<p>When I create a new entity class and want to have more than one List in it, Xpert.ivy says: "If an entity class has more than one collection you have to use 'Set' instead of 'List' as type."</p> <p>I think the JEE Persistence API does not have this limitation.</p>HaraldWeberThu, 14 Aug 2014 11:32:10 -0400https://answers.axonivy.com/questions/912/why-can-i-only-have-one-field-of-the-type-list-in-my-entity-classpersistencePersistence Object is not saved - ForeignKey is Null.https://answers.axonivy.com/questions/667/persistence-object-is-not-saved-foreignkey-is-null<p>We have two persistence objects where a hasMany b. So a is a property of b.</p> <p>Now we are creating an object of type b and asign the corresponding a-object to b. </p> <pre><code>b.a = a; </code></pre> <p>Then we try to save the newly created b object via:</p> <pre><code>ivy.persistence.persistenceUnit.merge(b); </code></pre> <p>Then it throws an error that the ForeignKey of a in table b cannot be null. But in the debugger object a is assigned correctly to object b.</p> <p>In which pitfall did I run here?</p>Nikel WeisTue, 29 Apr 2014 08:45:16 -0400https://answers.axonivy.com/questions/667/persistence-object-is-not-saved-foreignkey-is-nullpersistenceIs it possible to create an ivy persistence object from String?https://answers.axonivy.com/questions/658/is-it-possible-to-create-an-ivy-persistence-object-from-string<p>Usually a persistence object is created via:</p> <pre><code>import objects.Product; // persist new created product Product product; product.name = "Product name"; product.nr = 12; ivy.persistence.webshpo.persist(product); </code></pre> <p>What we are trying to do (for a dynamic interface) to dynamically create the persistence object with something like:</p> <pre><code>Object persistenceObject = Class.forName(in.persistenceClassName).newInstance(); </code></pre> <p>Is that generally possible? Can that be achieved in a ScriptStep or just in a JavaClass?</p> <p>Edit: We tried to give the full package name in the code mentioned above which returns a ClassNotFoundException:</p> <p>Object persistenceObject = Class.forName("objects.Product").newInstance();</p> <p>Edit 2: Changed persistenceUnit naming to persistenceObject according to Daniel's comment.</p>Nikel WeisFri, 25 Apr 2014 10:39:01 -0400https://answers.axonivy.com/questions/658/is-it-possible-to-create-an-ivy-persistence-object-from-stringpersistenceIs it possible to apply field order of a persistent data-class to database table?https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table<p>I've noticed that if I use the persistence API to create a database table the order of the table columns is not the same as in the persistence data-class. Is it possible to keep the field order in a data-class to a database table?</p>Nikel WeisThu, 24 Apr 2014 10:29:21 -0400https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-tablepersistenceEndless circular relation in 1:n relation correct?https://answers.axonivy.com/questions/643/endless-circular-relation-in-1-n-relation-correct<p>I've a 1:n relation defined using the persistence api. One customer has n delivery adresses. In the history object this appears as customer object who has a list of delivery addresses. Those delivery addresses themself also have a customer attached and that customer a list of delivery addresses and so on and so forth. While this is semantically correct im wondering if I did something wrong or is this correct?</p>Nikel WeisThu, 17 Apr 2014 08:43:07 -0400https://answers.axonivy.com/questions/643/endless-circular-relation-in-1-n-relation-correctpersistencePersistence Api - Many to Many Relationshiphttps://answers.axonivy.com/questions/616/persistence-api-many-to-many-relationship<p>Is it possible to declare a many to many relationship in the Entity Class Editor?</p>HaraldWeberWed, 02 Apr 2014 14:12:20 -0400https://answers.axonivy.com/questions/616/persistence-api-many-to-many-relationshippersistence