Databases Reference
In-Depth Information
In our example, the adapter was able to work out relationships
between tables by analysis of the foreign keys. If foreign key
relationships do not exist, then the Create button may be used
to inform the adapter of relationships that exist between tables.
Under the covers
Under the covers, a lot has happened. An offline copy of the relevant database
schema has been created so that the design time is not reliant on being permanently
connected to a database. The actual mapping of a database onto an XML document
has also occurred. This is done using Oracle TopLink to create the mapping and a
lot of the functions of the wizard are implemented using TopLink. The mapping can
be further refined using the features of TopLink.
Using keys
Always identify the Primary Key for any table used by the database
adapter. This can be done by applying a Primary Key constraint in the
database, or if no such key has been created, then TopLink will prompt
you to create one. If you have to create one in TopLink, then make sure
it is really a Primary Key. TopLink optimizes its use of the database by
maintaining an identity for each row in a table with a Primary Key. It
only reads the Primary Key on select statements and then checks to see
which records it needs to read in from the database. This reduces the
amount of work mapping fields that have already been mapped because
a record appears multiple times in the selection. If you don't identify a
Primary Key correctly, then TopLink may incorrectly identify different
records as being the same record and only load the data for the first such
record encountered. So if you seem to be getting a lot of identical records
in response to a query that should have separate records, then check your
Primary Key definitions.
Summary
In this chapter, we have looked at how to use the file and database adapters to turn
file and database interfaces into services that can be consumed by the rest of the SOA
Suite. Note that when using the adapters, the schemas are automatically generated
and changing the way the adapter works may mean a change in the schema.
Therefore, in the next chapter, we will look at how to isolate our applications
from the actual adapter service details.
 
Search WWH ::




Custom Search