O'Reilly logo

Building Java Enterprise Applications by Brett McLaughlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Populating the Data Stores

Once everything is in place, you are ready to get to data population. Example 7-2 shows a client class, called EntityCreator, that connects to the application server, creates a lot of sample data, and then does the same for the directory server. While the class is fairly long, it does almost nothing very exciting. Your work through the first chapters should make this all fairly simple stuff by now. Enter in the source code and compile it, and get ready to test the application data stores.

Example 7-2. The EntityCreator Data Population Class

package com.forethought.client; import java.rmi.RemoteException; import java.util.Properties; import javax.ejb.CreateException; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.rmi.PortableRemoteObject; // Office bean import com.forethought.ejb.office.Office; import com.forethought.ejb.office.OfficeHome; // User bean import com.forethought.ejb.user.User; import com.forethought.ejb.user.UserHome; // Fund bean import com.forethought.ejb.fund.Fund; import com.forethought.ejb.fund.FundHome; // Account bean import com.forethought.ejb.account.Account; import com.forethought.ejb.account.AccountHome; // LDAP Manager import com.forethought.ldap.LDAPManager; public class EntityCreator { public static void main(String[] args) { try { // Get an InitialContext Context context = new InitialContext( ); Object ref = null; // Look up the Office bean System.out.println("Looking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required