Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

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

asked 2016-04-22 07:10:19 -0500

Harvey gravatar image

updated 2016-04-22 07:12:03 -0500

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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.

answered 2016-04-23 07:23:28 -0500

Dixson Huie gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-22 07:10:19 -0500

Seen: 167 times

Last updated: Apr 23 '16