Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

The Java Persistence API is a new programming model under EJB3.0 specification (JSR220) for the management of persistence and object/relational mapping with Java EE and Java SE. With JPA, developers can easily develop java applications that perform operations on relational database management systems using java objects and mapping. In that way, java applications developed using JPA are not only portable across different platforms, but also applications can be easily developed using simple yet powerful programming model provided by JPA. This greatly improves application maintainability against ever changing database world. JPA insulates applications from all the complexity and non-portable boilerplate code involved in database connectivity and operations.

...

If target runtime is not setup, create a new target runtime pointing to geronimo installation directory. For more information, look at the geronimo documentation that explains setting up eclipse plugin for geronimo and setting up runtime environment. This setup is required to resolve class dependencies during compilation.

...

8. Copy the following contents into Account.java.

...

9. Similarly, as given in the previous step, create Person.java and add the following contents to it.

...

9. Similarly, create AccountInterface.java and copy the following contents.

...

10. Similarly, create AccountBean.java.java and copy the following contents. Note that several lines have been truncated for display.

...

...

11. As outlined above, right click on the META_INF directory of BeanManagedJPA-EJB project and
create persistence.xml. Copy the following contents into persistence.xml.

...

.xml.

...

12. Since we are going to use EJB annotations, the META-INF/ejb-jar.xml will not have any declarations. The contents of the META-INF/openejb-jar.xml file should be as below. Otherwise, modify it accordingly.

...

13. Finally the project BeanManagedJPA-EJB should like as below.

...

5. Right click on the WebContent folder of the web project and navigate to New => HTML to create the index.html file as given in the screen shot. Click on the Next button and on the next screen click on the Finish button. The contents of the index.html is provided below the screen shot.

...

6. Right click on the WebContent folder of the web project and navigate to New => HTML to create the ViewAccount.html file as given in the screen shot. Click on the Next button and on the next screen click on the Finish button. The content of the ViewAccount.html is provided below the screen shot.

...

...

9. Similarly, as illustrated in the previous steps, create RetrieveAccount.jsp. The contents of the of the jsp is as follows.

...

...

10. Similarly, as illustrated in the previous steps, create TransferAmount.jsp. The contents of the jsp is as follows.

...

...

11. Right click on the BeanManagedJPA-WEB project and click on Properties to open Properties for BeanManagedJPA-WEB wizard. Click on the Java Build Path and Projects tab. Click on the Add button and add BeanManagedJPA-EJB project. Finally, click on the OK button on Properties for BeanManagedJPA-WEB wizard. This is required because, BeanManagedJPA-WEB projects looks up AccountInterface ejb in the BeanManagedJPA-EJB project. To resolve the dependency during compilation, the EJB project has to be added to the build path of the WEB project.

...

4. The above step will create AccountDB database. On the same screen, enter the below SQL command on the SQL Command/s textarea and select AccountDB in the Use DB combo box and click on the Run SQL button. This will create ACCOUNTCME table in the AccountDB database.

...

5. Similarly, enter the below SQL command on the SQL Command/s textarea and select AccountDB in the Use DB combo box and click on the Run SQL button. This will create PERSONBME table in the AccountDB database.

...

6. Insert the two rows using the below SQL command.

...

...

After inserting the rows, table will look like the below screen shot.

...

1. Deploy the EAR file as follows

...

...

Running the application

1. Open a browser window and hit the URL as http://localhost:8080/BeanManagedJPA-WEB/. This brings upthe screen shot below. Click on the View Account Details link.

...