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 that the reference must be exactly this type and not a subtype
identification-variable IS OF TYPE ( [ONLY] type-1, [ONLY] type-2, ..... )
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
SELECT OBJECT(e) FROM EmpBean eIf you are interested in objects which are employees and not managers and not executives
SELECT OBJECT(e) FROM EmpBean e WHERE e IS OF TYPE( ONLY EmpBean )If you are interested in object which are managers or executives
The above query is equivalent to the following querySELECT OBJECT(e) FROM EmpBean e WHERE e IS OF TYPE( ManagerBean)SELECT OBJECT(e) FROM ManagerBean eIf you are interested in managers only and not executives
orSELECT OBJECT(e) FROM EmpBean e WHERE e IS OF TYPE( ONLY ManagerBean)SELECT OBJECT(e) FROM ManagerBean e WHERE e IS OF TYPE (ONLY ManagerBean)
See Also
EJB query language
WHERE clause
Using EJB query