Using View Objects with Polymorphic Entity Usage
A polymorphic entity usage is one that references a base entity object in an inheritance hierarchy and is configured to handle subtypes of that entity as well. The slide shows the results of using a VO with a polymorphic entity usage. The entity-based PersonListVO View Object has the PersonEO entity object as its primary entity usage. The VO partitions each row retrieved from the database into an entity row part of the appropriate entity object subtype of Person. It creates the appropriate entity row subtype after consulting the value of the discriminator attribute. For example, if the PersonListVO query retrieves one row for the person Pam, one row for each staff member (Gary and Glenn), and one row for each customer (Kate, Jeff, and Patrice), the underlying entity row parts are as shown in the slide. The rows show the attributes that all subtypes have in common.