When to use Dao classes like DaoFilterCriteria, ShipmentHeaderRow etc
and when to use Model data service?
For example,
DaoFilterCriteria filter = new DaoFilterCriteria();
List<ShipmentHeaderRow> shipmentLegs = getDaoAccessor().getRows(ShipmentHeaderRow.class, filter);
fetches ShipmentHeaderRows,
whereas
ModelDataService mds = Services.get(ModelDataService.class)
List<Shipment> shipments = mds.read(Shipment.class, context, params, modelQueryComponentArray)
fetches Shipments.
What is the difference between using ShipmentHeaderRow and Shipment?
Also what is the difference between using ( MDS or SqlService ) and Dao/DaoFilterCriteria etc classes?
Don't use DAO for any new code. It's deprecated.
As far as MDL versus SqlService, here's what you should think about:
Characteristics of SqlService:
Characteristics of ModelDataService:
In general, I would think you would want to use ModelDataService in cases where we used DAO in the past. One key difference is, the default behavior of MDS is to return a level plus all its child levels. This is expensive for Shipments with many Lines. Consult the MDS javadocs to see how you can ask it to return the header only.
Thanks @Greg Merrill for mentioning about filtering what levels to retrieve.