+

Search Tips   |   Advanced Search

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.


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 we are interested in objects which are employees and not managers and not executives:

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

The previous query is equivalent to the following query:

If we 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 tasks

  • Use EJB query