Creating a New Entity Row
In addition to using the entity definition for finding existing entity rows, you can also use it to create new ones. For example, you could write a createProduct() method to accept the name and description of a new product, and return the new product ID assigned to it. Assume that the ProdId attribute of the Product entity object has been updated to have the DBSequence type, so that its value is automatically refreshed to reflect the value that the ASSIGN_PRODUCT_ID trigger on the PRODUCTS table assigns to it from the PRODUCTS_SEQ sequence in the database schema.
The example follows these steps:
1. Find the entity definition: Use EntityDefImpl.findDefObject() to find the entity definition for the ProductEO entity.
2. Create a new instance: Use the createInstance2() method on the entity definition to create a new instance of the entity object. (The method name really has a 2 at the end. The regular createInstance() method has protected access and is designed to be customized by developers. The second argument of type AttributeList is used to supply attribute values that must be supplied at create time; it is not used to initialize the values of all attributes found in the list. For example, when creating a new instance of a