Learn to create an EJB V3.0 entity Bean using the ECLIPSE-WEBSPHERE7-DB2 database
Introduction: EJB V3.0 provides a robust toolset for implementing data persistence using Java™ technology. Using EJBS is not difficult. Learn how to use these features in your Eclipse environment, and make your applications more tightly integrated with useful data. Although this article takes a trial version of the ibm®websphere® application server and db2® as an example, the technology discussed can be applied to the Community edition of WebSphere Application Server and DB2.
Brief introduction
Data availability has changed in the area of application development. Different data comes from different sources. On the one hand, this makes the application richer than ever; on the other hand, all this data may become difficult to handle. If you need to persist data, not just read it, the situation becomes more complex.
In the Java environment, EJB appears as a reliable persistence method that enables good maintenance and proper role separation. The EJB V3.0 continues to evolve, and more and more tools and methods are emerging. Using EJBS is not difficult. For Eclipse and some basic concepts, you can take advantage of them in your application.
EJB V3.0
EJB V3.0 simplifies the development of EJBS by using annotated APIs, where remote/local interfaces, home/local interfaces, and deployment descriptors are no longer needed, but can continue to be used. Developing Entity EJB requires a Java IDE, an application server, and a relational database. WebSphere v6.x requires the creation of an EJB V3.0 entity Bean using the WebSphere application Server V6.1 Feature Pack. The WebSphere V7 itself has support for EJB V3.0. The Eclipse IDE is one of the most commonly used open source Java Ides. In this article, we will develop an EJB V3.0 entity Bean by using Eclipse, IBM WebSphere7, and IBM DB2 9.5来.
The EJB V3.0 specification for WebSphere uses the Java persistence API (JPA) to implement persistence. JPA is based on other persistence technologies, such as Hibernate, JDO, and TopLink. JPA is a POJO persistence API for object-relational mapping, which uses metadata annotations to define mappings between Java objects and a relational database. JPA supports class SQL languages for static and dynamic queries. JPA is integrated into the Jsr220:enterprise JavaBeans V3.0 specification.
This article uses a trial version of the WebSphere Application server and DB2 database, but the techniques discussed here can be applied to the Community edition of WebSphere Application Server and DB2. The beta version of WebSphere application Server contains free support. The community version of WebSphere application Server also has support.
Environmental preparedness
Download and install the WebSphere application Server V7.
Download and install the Eclipse IDE for Java EE developers.
Download and install DB2 V9.5.
Create a data instance sample in DB2.
Configuring WebSphere and DB2
Start the WebSphere application Server. In the Steps Console, select the Start server. The WebSphere server is started, as shown in Figure 1.
Figure 1. Start WebSphere v7 Application Server