datasource vs datamanager CRUD

Hi, I am a bit lost with regards to whether I should use datasource or datamanager to perform crud operations.

  1. What is the difference between the two?
  2. When should I use one over the other?

DataManager is a programmatic interface for CRUD, working on both middle and client tiers.

Datasource is a pure UI feature - it enables binding of UI components to entities. You can define them declaratively in XML or create in Java code using DsBuilder. When using declaratively, datasources automatically follow the screen lifecycle - load entities on open and save them on close if there are any changes.

Datasources have no convenient API for CRUD, so use them only when you need to display entities in visual components. Unlike datasources, DataManager is specifically designed for programmatic CRUD, so use it from your Java code if needed. See an example here:

Thank you very much for your kind explanation and reference to example. This clarifies my question.