Databases provide the common database objects that include
tables, views, and synonyms.
Table is a common database schema object in a database. The table
objects are used to store data in the database. Databases such as DB2®, Oracle, and SQL Server provide
a number of table types such as object, normal, nested, clustered,
index-organized, for entering data into the database.
View is a database object that is considered as a virtual table
or a stored query. Views do not store the data physically in them;
instead they derive the data from the base table on which they are
created. All the operations that are performed on the tables can be
performed on views too.
Synonym is an alias or an alternative name given for the database
objects such as the tables, views, and other database objects.
Wrapper business objects
A wrapper business
object enables you to manipulate unrelated table and view business
objects in a single operation. The wrapper business object contains
simple attributes for the primary keys of each child business object.
The name of the field is the string "wrap", followed by the database
table name and the column name of the primary key of the table. The
wrapper business object also contains a complex attribute for each
table business object. The name of the attribute is the table name
appended with the string "obj". The type of the complex attribute
is the name of the corresponding table business object.
In the
following example, the wrapper business object generated WrapperBO
contains three child business objects. Db2adminCustomer that has a
primary key (pkey), Db2adminCustInfo that has a primary key (ccode),
and Db2adminCustomer_Compositekey that has a composite primary key
(fname, lname). The following sections describe how to execute the
Create, Update, Delete, and Retrieve operations on this wrapper business
object.
Figure 1. Wrapper business object
You can create wrapper business objects in the Specify Composite Properties window
of the external service wizard.
For information about how to create wrapper business objects, see Setting global properties for operations and creating wrapper business objects. The
wrapper business objects support the Create, Retrieve, Update, and
Delete operations. The behavior of each operation is explained in
the table below.Table 1. Behavior of operations
on wrapper business objects| Operation |
Action |
| When you set a value of a wrapper business
object and there are no corresponding child business instances of
the key |
When you set the value of a key in wrapper
business object, and add a child business object instance:- If the primary key of the child business object instance is not
set, the primary key value of the child business object instance is
copied from the corresponding key in the wrapper business object and
is used to execute the operation.
- If the primary key of the child business object is If the child
business object instances primary key value is set and different from
the corresponding key value in the wrapper business object, then the
key value in wrapper business object is ignored and the key value
of the child business object is used to execute the operation.
|
| Create |
The Create operation is executed successfully
and the returned child business objects are empty. No record is inserted
in the database. |
If the record of the child business object
instance does not exist in the database, the record is inserted into
database. If the record of the child business object instance exists
in the database, the adapter returns the UniqueConstraintViolatedException. |
| Retrieve |
- If the key is valid, the corresponding record of the key is returned.
- If the keys are invalid, no record is returned.
|
- If the record of the child business object instance exists in
the database, the record is returned.
- If the record of the child business object instance is not found
in the database, the adapter returns the RecordNotFoundException.
|
| Update |
The Update operation is executed successfully.
No record is updated in the database. |
- If any child business object does not exist, the record is inserted
into the database.
- If the child business object exists, the record is updated in
the database.
- If the primary key for any child business object is unset, the
record is updated with the key value copied from the corresponding
key in the wrapper business object.
|
| Delete |
The Delete operation is executed successfully
if the key is valid, and the corresponding child business object is
deleted. |
Only the specified child business object
is deleted. - If the primary key for any child business object is unset, the
record with the wrapper business object key value is deleted.
- If any child business object does not exist in the database, the
adapter returns the RecordNotFoundException.
|
Enabling IBM WebSphere Adapter for JDBC to
dynamically pick the database schema name at run time