Best Practice for Sign-In Process in Mendix: Non-Persistable vs. Persistable Entities?

Hello, all,   I am a newbie in this field and am exploring some learning paths in the Mendix Academy. While studying, I am wondering which method is the best practice for the sign-in process.     Method 1: Module Name: Create an App with Advanced Page Building In this module, the example solution creates a non-persistable entity named 'Registration', and then copies the values to the newly created account object.     Method 2: Module Name: Building an Event App Using Microflows In this module, the example solution creates a persistable entity named 'Registration' and rolls back the data after copying it to the newly created account object.     Is there any difference between them? Personally, I think the first method is the best practice since it uses a non-persistable entity in the right way.   I would be grateful if you could clarify this issue.   Thank  you.  Best Regards.        
2 answers

Hi Gain Lee,

    Persistent entity is used when you are storing or interacting with the database. Basically, if the user needs to store something in database as table and is used in the application persistent entity is used. But if you need to manipulate something on run time and then discard that (basically no database interaction) then non - persistent entity is used. It helps reduce server trips, (in case of persistent entity there will always be a database interaction) making it faster in performance in cases where run time data is calculated.

For example: Using Non - persistent entity to calculate price of multiple order will always be a better approach. And then use persistent entity to store price of order.


I hope it helps, in case of it answer your query please accept or put a comment if you need more insights.


Best Regards,

Dibyanshu Singh


Because in the 2nd case there is many to many relation between ticket and registration so I think whenever someone is registering, he is registering for an event ticket and for one ticket there will be multiple registrations but with non-persistent entities you cannot create many to many association with persistent entity. so that's why here they have used Persisitent entity and rolls back the data.