Query only base object

We have a class ShipmentCompletion it has 2 child class EMEAShipmentCompletion, APACShipmentCompletion. In space objects of all these 3 types are written. So lets say ShipmentCompletion has 1 object, EMEAShipmentCompletion as 2 objects and APACShipmentCompletion has 2 object.

Now i query the space for counting the ShipmentCompletion object it gives me a count of 5, I need to strictly count only the objects of Base class not the child classes i.e. count i should get be 1. Is this possible ?

Id for all objects is generated automatically so i dont know the the id before hand

1 Answer

The easiest solution is to enhance the classes a bit to make this queryable. For example, add getShipmentType() to the base class which returns "default", override it in the sub classes to return "emea" and "apac" respectively.

Another option is to modify the inheritance a bit: use an abstract class for the super; and have shipment, emeashipment and apacshipment extend it. This is more efficient in terms of storage, but introduces some semantic changes which the application might be sensitive to.