I would appreciate if someone explains when to use a DataManager and when to use EntityManager. which one is recommended for large applications especially at middle tier?
This is an important topic, and we will cover it in the documentation.
- DataManager is available on both middle and client tiers.
- DataManager is a singleton bean.
- DataManager defines a few high-level methods for working with detached entities: load(), loadList(), reload(), commit().
- DataManager starts new transactions internally.
- DataManager applies all security constraints when invoked on the client tier.
- EntityManager is available only on the middle tier.
- You should obtain a reference to EntityManager through the Persistence interface.
- EntityManager mostly resembles the standard javax.persistence.EntityManager.
- You have to open a transaction before working with EntityManager.
- EntityManager does not impose security constraints.
I would recommend using DataManager when you don’t need to control transactions or work with managed entities. DataManager is simpler - it always starts and commits transactions inside and returns detached entities.
Thank you very much.
How does DataManager works when I need record/entity locks in transaction?