Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The tutorial creates an enterprise application that has an ejb module and a web module. The ejb module uses Account entity and Person entity. The Account entity has accountNumber, personId and balance attributes. The Person entity has personId, personName and address attributes. The personId in Account entity refers to personId in Person entity. The AccountBean injects EntityManagerFactory from which it creates EntityManager object. It is a stateful session bean which has Account entity object, corresponding Person entity object, EntityManager object and EntityManagerFactory object as state fields. The bean has updateAllValues(String address, String personName, double balance) method that updates Account and Person entity attributes. It has also deposit(double amount) and withdraw(double amount) methods for withdrawing and depositing the amounts to the account. In all the above mentioned methods, the EntityManager object joins the active transaction using joinTransaction() method as the its transaction-type is JTA and bean's transaction is managed by the container. The initialize(integer accountNumber) initializes the bean with Account and Person}} entity objects corresponding to the {{accountNumber sent as the parameter. Finally, the EntityManager object is closed in the destroy() method.

...

1. Start the geronimo server and open the admin console on a browser window with the url
http://localhost:8080/consoleImage Removed.

2. Click on the Embedded DB => DB Manager on the Console Navigation portlet.

...

Code Block
SQL
SQL
borderStylesolid
insert into PERSONBME values (1, 'Shane Gibson', '#120, Manhattan, NewYork, USAXXXX');
insert into PERSONBME values (2, 'Rameez Raza', '#130, Times Square, NewYork, USAYYYY');
insert into ACCOUNTBME values (10,1,6500);
insert into PERSONBME values (11,2,9000);

...

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

...