ForteTM for JavaTM Enterprise Edition includes tools and modules to
make the creation and testing of Enterprise JavaBeansTM (EJBTM)
components easier and more flexible. Part one of a tutorial on the
JavaTM technology Web site introduces the process
of creating and testing session beans, both stateless and stateful,
with Forte for Java Release 3.0, Enterprise Edition. Developers are
provided an opportunity to quickly grasp some of the key concepts and
capabilities of this process.
EJB Component Support
The Forte for Java IDE invisibly manages (automates) many
tasks that would otherwise have to be
programmed by hand. For example, here are a few EJB component-related tasks which
the IDE automates:
- Write method declarations for the basic classes: The IDE generates
the necessary classes for each bean and the method declarations within
- Provide code to manage transactions and persistence: The application
server takes care of those tasks for you.
- Keep your bean classes, interfaces and methods synchronized: The IDE
maintains consistency for you.
- Write XML code for the deployment descriptor: The IDE generates this
- Manually create a test client to test the enterprise bean: The IDE
provides comprehensive, GUI-based support for testing your beans.
- Search the JavaTM 2 Platform, Enterprise Edition (J2EETM)
documentation: The enterprise bean source code generated by the IDE
conforms to J2EE platform standards and includes comments.
The EJB Builder wizard is used to generate a basic enterprise bean. The
wizard automatically tailors the enterprise bean according to your
specifications, whether a session or entity bean, and with options for
transaction and persistence management. The wizard guides you through
the steps required to create the basic components.
Next, you would typically add methods to the bean, using further
features of the EJB Builder, and then the Source Editor to finish
coding the bean.
In the enterprise bean model, transactional behavior is designed to be
handled both implicitly and declaratively. When a method is invoked on
a bean instance, the EJB container intervenes and manages the
transaction automatically. Consequently, as a developer, you don't have
to be expert in writing transactions, and you don't have to write or
debug the code which controls transaction boundaries.
Sometimes, however, you might need to program transactions explicitly
in a session bean. In this case, the IDE enables you to declaratively
override the container, and supports the use of the JavaTM DataBase
Connectivity (JDBCTM) API, the Java technology transaction API, or the
IDE's Transparent Persistence module to manage your beans'
As with transaction support, the IDE enables you to either delegate a
beans' persistence handling entirely to the EJB container, or to code
If you wish, for example, to restrict access to certain methods in your
enterprise bean to users in certain roles, you can add programmatic
security to the bean. However, it is not necessary to write full
security routines in the bean's source code. Instead, a security
reference in your bean code can be matched to a security role which you
declare for a method.
For details on the design of enterprise beans and the EJB architecture tier, refer
to the Enterprise JavaBeans Specification at the following URL:
Other sections of the tutorial include creating a stateless session bean and creating a
stateful session bean. For additional technical details:
Read More ...