WAS v8.5 > Develop applications > Develop Dynamic and EJB query > Develop applications that use EJB query > EJB query language > WHERE clause

IS OF TYPE predicate

The IS OF TYPE predicate is used to test the type of an EJB reference. It is similar in function to the Java instance of operator.

IS OF TYPE is used when several abstract beans have been grouped into an EJB inheritance hierarchy. The type names specified in the predicate are the bean abstract names. The ONLY option can be used to specify the reference must be exactly this type and not a subtype.


Example: IS OF TYPE predicate

Suppose that bean ManagerBean is defined as a subtype of EmpBean and ExecutiveBean is a subtype of ManagerBean in an EJB inheritance hierarchy.

The following query returns employees as well as managers and executives:

If you are interested in objects which are employees and not managers and not executives:

If you are interested in object which are managers or executives:

The previous query is equivalent to the following query:

If you are interested in managers only and not executives:

or:
SELECT  OBJECT(e) FROM  ManagerBean e
WHERE  e IS OF TYPE (ONLY ManagerBean)


Related concepts:

EJB query language
WHERE clause


Related


Use EJB query


+

Search Tips   |   Advanced Search