HHH-9357 Fix type() with joined inheritance and discriminator column.

We now make use of the discriminator column if available when testing the type of an entity in the where clause.