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.