Understanding Non-Presistable Entites

0
Hi All, I need some help with understanding how to actually use Non-Presistable Entities because every time I attempt to use them, I am not able to access the data or display it on the screen. I am only trying to understand them so I can leverage them in real projects as I think it would be useful to be able to leverage temporary data vs going to a database all the time. I am pretty sure I am missing something with how they should work or be used. I attempted to look at the docs but all I can find on it is they are a temporary storage that needs to be retrieved by an association. How I think I should be able to use them is to have a user add some list items to a Non-Presistable entity and they would be able to edit the data on the screen. Then when they are ready to keep that data, move it to a presentable entity. What I am trying to do is have a form and a data grid on the same page. When the user enters in data to the form, the data is put into the Non-Presistable entity and then it is shown in the data grid or on the page using another widget. I attempted to do this multiple ways but I can’t seem to get the data to display. Can anyone point me in a direction to get a better understanding on how and when to use the Non-Presistable entities?
asked
1 answers
0

Hi Drew,

 

So indeed, a non-persistent (NP) entity is not stored in the database, it is only present in the client. 

 

One way you could use your non-persistent entity list is to create a ‘container’ persistent or non-persistent entity, which you will associate your non-persistent entities with. You can use this container as your input to your flows and retrieve the necessary list items. (Although in your case, why not use the persistable entity directly, and just rollback all the changes when the user does not want to ‘save’ their changes?)

 

If I recall correctly, your NP objects will remain in your state as long as they are associated to a (persistable) object which is also still in your current state. Once this ‘container’ object is gone, and you don't have your NP object in your page, there is no way to retrieve your object anymore.

 

Non-persistent entities are excellent to be used for user interface purposes. For example if you want to show if something is selected or not.

 

By the way, a datagrid is always a database retrieve, hence you cannot retrieve NP entities in here, or associations to NP entities.

 

Hope this helps!

answered