|
Implementation
The BC4J-VSM entities are implemented in the oracle.otnsamples.vsm.entities
package, and the views are implemented in the oracle.otnsamples.vsm.views
package.
The Oracle9i JDeveloper environment comes with comprehensive
tools support for putting the BC4J framework components to use in J2EE applications.
You use interactive wizards, editors, property inspectors, and UML diagrammers
to create, enhance, and deploy your BC4J components. These tools are tightly
integrated within a complete Java IDE that includes debugging, deployment, and
source control support, so you can work from the beginning to the end of your
J2EE application development lifecycle with one tool.
When you use a BC4J wizard to create entity objects from existing
tables (reverse generation), it creates one entity object for each database
table. It creates an entity attribute for each column in the database table;
each attribute can have the same name as the column or a different name that
is more meaningful to your business application. The attribute definitions of
an entity object reflect and enforce the properties of the respective database
columns, including data types, column constraints, and precision and scale specifications.
An entity object can have an attribute for each column or you can use a subset,
for example, if you don't need to work with that column or if a table contains
information for more than one entity.
You can also use BC4J wizards to define entity objects, and
their attributes, without starting from an existing database table (forward
generation). When you use a wizard to generate database tables from entity objects,
it creates a table for each entity object, a table column for each entity attribute,
and column constraints based on the entity attribute settings. In addition,
you can use the Entity Constraint Wizard to define table constraints.
The best place to write your business logic is in entity objects,
because they consistently enforce business logic for all views of data, accessed
through any type of client interface. Business logic includes the following
items:
-
business rules and policy - When adding or modifying data, you can
ensure that the data complies with your organizations' procedures before
adding it to the database. For example, you could increase the salary when
an employee is promoted, give an employee three weeks of vacation after
they have been at a company three years, or change the status of an order
to shipped after all items in an order have been mailed to a customer.
-
validation logic - When adding new data, you can ensure that the
data is valid before storing it in the database. For example, you could
ensure that a job code is a valid job code.
-
deletion logic - You can make sure that data is deleted only when
appropriate and that any dependencies are handled. For example, you could
prevent an on-leave employee from being removed.
-
calculations - You can efficiently perform data calculations in
the business logic tier. For example, you could calculate an employee's
monthly pay based on an hourly rate.
-
default value logic - When creating new data, you can add appropriate
default values. For example, you could provide a default benefit plan based
on an employee's job code.
- security - You can make sure that data is read
and modified only by users with that authority. For example, you could ensure
that only the direct manager can change an employee's salary. Business logic
in an entity object provides immediate feedback to the user if changes are
inappropriate. This way, the in-memory business model always remains consistent.
You can create default view objects in the following wizards:
Business Components Project Wizard or Editor Package Wizard or Editor Entity
Object Wizard You can create default view links, based on existing associations,
and a default application module by using the Business Components Project Wizard
or Editor or Package Wizard or Editor.
|