The View Object Editor lets you create and edit view objects.
Default view objects are very simple in their definition. Use the View Object Wizard and Editor to create and edit view objects so they are tailored to your needs. This might include a view object that uses
a subset of an entity object's attributes
attributes from more than one entity object
special SQL-derived or transient attributes
non-default storage and updateability features
The ability of a view object to use multiple updateable entity objects enables one of the key features of Business Components for Java: a single view object can update multiple entity objects.
To edit a view object, in the Workspace view of the Navigator, right-click the view object and choose Edit object.
When editing a view object, the editor lets you specify the following information, listed by page:
Attributes and Attributes Settings pages. Specify attributes you want to include from the entity object, define new attributes (you can define transient or SQL-derived attributes), and specify attribute settings. Settings include attribute name, attribute type, alias, SQL expression, whether it is updateable always, when new, or never, and whether it is selected in the view object's query and queriable. You want to include only the attributes you need for a form in the client UI, to save memory and improve performance, but avoid fault-in. You must include primary key(s) if the underlying entity objects are updateable; this is enforced by the wizard.
Query page. Optionally customize the view object's SQL statement. You can add WHERE and ORDERBY clauses. Click Browse to select attributes by which to order the query results. If you want to modify the query in other ways, such as the automatically generated SELECT and FROM clauses, you can select Expert Mode. Click Test to verify that the SQL statement is syntactically correct.
Attribute Mappings page. If you selected Expert Mode, you can map query result columns to view object attributes. You need to remap these items if you deleted, added, or switched positions of columns in your custom SQL query, because the mappings will no longer be correct.
Java page. If you want to customize a view object, you can specify that the wizard generate a Java file for the view object class, view row class, or both. By default, the wizard generates the view object class, but not the view row class.
Exported Methods page. Select methods to export, so the client can use them remotely. Methods you've written in the view object class file appear in the Available list; to appear in the list, they must be of a data type that implements the Serializable interface. To export them, move them to the Selected list. Before you can use this page, in the Java page, you must select Generate Java File for the view object class. You need to do a few other things before the client can use the methods, including making the application module remoteable, importing the package in the client code, and invoking the method properly in the client code, as described in the Business Components for Java online help.
Property page. To add a property, type a property name and value, then click Add. You can also add and edit values for existing properties, and delete properties.
If you change a database table after you have created a view object and you need to modify the view object, you can make the change manually in the View Object Editor. For example, you can add attributes corresponding to new columns in the entity object.