How to get the Discriminator Value in Entity Inheritance

Hi,

I am playing with the entity-inheritance sample to try a couple of things.

I have created a Browse screen for the Customers. I am adding a BeforeActionPerformedHandler to the Edit Action. What I want to do is check what Customer they have selected and open the appropriate screen if it is a Company or a Person. This seems like a logical thing to want to do.

As the Discriminator column is called DTYPE in the example I was hoping I could do something like the following.

customersTableEdit.setBeforeActionPerformedHandler(new Action.BeforeActionPerformedHandler() {
    @Override
    public boolean beforeActionPerformed() {
        String discriminator = customersTable.getSingleSelected().getDType();
        return false;
    }
});

I can’t seem to find a way to get the Discriminator value anywhere. I’ve tried a couple of things like a transient column and read only columns of the same name but these mess CUBA up.

I’m sure you guys at CUBA have got something hidden away I can find.

Any help greatly appreciated.

My bad.

The type of entity is actually is not the root type but one of the derived types.

So even though I’m loading a list of Customers I get a list of Entities that are InstancesOf Person or Company.

Problem solved.