
Copyright (C) BULL S.A. 1998-2002


Entity beans "Customer-Phone" for xdoclet
-----------------------------------------
CustomerBean	entity bean with CMP2 persistance and relationship (CustomerBean--1------------n-->PhoneBean)
PhoneBean	entity bean with CMP2 persitance

this directory contains initially only this files :
build.xml		: the build which contain target for xdoclet and jonas compilation
build.properties	: properties for jonas target
CustomerBean.java	: Bean class with xdoclet tag
PhoneBean.java		: Bean class with xdoclet tag
Name.java		: Utilities class
ClientCustomer.java	: Client 
README			:

Generated this example with xdoclet:
-----------------------------------
Using default target (install) ;

You should have this return :
ejbdoclet:
[ejbdoclet] Dec 15, 2004 2:39:04 PM xdoclet.XDocletMain start
[ejbdoclet] INFO: Running <remoteinterface/>
[ejbdoclet] Generating Remote interface for 'xdoclet.CustomerBean'.
[ejbdoclet] Dec 15, 2004 2:39:04 PM xdoclet.XDocletMain start
[ejbdoclet] INFO: Running <localinterface/>
[ejbdoclet] Generating Local interface for 'xdoclet.CustomerBean'.
[ejbdoclet] Generating Local interface for 'xdoclet.PhoneBean'.
[ejbdoclet] Dec 15, 2004 2:39:04 PM xdoclet.XDocletMain start
[ejbdoclet] INFO: Running <homeinterface/>
[ejbdoclet] Generating Home interface for 'xdoclet.CustomerBean'.
[ejbdoclet] Dec 15, 2004 2:39:04 PM xdoclet.XDocletMain start
[ejbdoclet] INFO: Running <localhomeinterface/>
[ejbdoclet] Generating Local Home interface for 'xdoclet.CustomerBean'.
[ejbdoclet] Generating Local Home interface for 'xdoclet.PhoneBean'.
[ejbdoclet] Dec 15, 2004 2:39:05 PM xdoclet.XDocletMain start
[ejbdoclet] INFO: Running <deploymentdescriptor/>
[ejbdoclet] Generating EJB deployment descriptor (ejb-jar.xml).
[ejbdoclet] Dec 15, 2004 2:39:05 PM xdoclet.XDocletMain start
[ejbdoclet] INFO: Running <jonas/>
[ejbdoclet] Dec 15, 2004 2:39:05 PM xdoclet.TemplateSubTask engineStarted
[ejbdoclet] INFO: Generating output 'jonas-ejb-jar.xml' using template file 'jar:file:/home/camillej/MyJonas/JONAS_4_2/lib/examples/xdoclet-objectweb-module-1.2.2.jar!/xdoclet/modules/objectweb/jonas/ejb/resources/jonas.xdt'.

compile:
    [javac] Compiling 10 source files to /home/camillej/MyJonas/JONAS_4_2/examples/classes

jonasejbjar:
   [ejbjar] building xdoclet.jar with 11 files
    [genic] GenIC for JOnAS 4.2.2: 'CustomerBean', 'PhoneBean' generation ...
    [genic] Stubs and Skels successfully generated for rmi/jrmp

install:
     [copy] Copying 1 file to /home/camillej/MyJonas/JONAS_4_2/ejbjars


9 files must be generated into the current directory :
 CustomerRemote.java
 CustomerLocal.java
 CustomerHomeRemote.java
 PhoneLocal.java
 PhoneHomeLocal.java
 PhoneBean.java
 CustomerHomeLocal.java
 jonas-ejb-jar.xml
 ej-jar.xml

Compiling this example:
-----------------------
ant install


Running this example:
---------------------
Your database access should be configured: a properties files defining a
  Datasource object should be defined in $JONAS_BASE/conf (e.g. InstantDB1.properties),
  and the property jonas.service.dbm.datasources of the jonas.properties file should
  be set to the name of this datasource description file (e.g. InstantDB1). See JOnAS
  documentation for more details.

1) Run an EJB Server to make beans available to clients:

on UNIX or Windows
		
	jonas start

2) Load xdoclet.jar if you have not added it in the ejb vice descriptors list:
 
    jonas admin -a $JONAS_BASE/ejbjars/xdoclet.jar

You should see something like this when the bean is loaded :
	...
2003-03-07 13:50:24,112 : JContainer.addBean : CustomerBean is loaded and using rdb.mysql
2003-03-07 13:50:24,112 : JContainer.addBean : CustomerBean available
2003-03-07 13:50:24,622 : JContainer.addBean : PhoneBean is loaded and using rdb.mysql
2003-03-07 13:50:24,622 : JContainer.addBean : PhoneBean available
2003-03-07 13:50:24,662 : ServiceManager.startServices : ejb service started

3) Run the client program:

on UNIX:
	jclient -cp $JONAS_BASE/ejbjars/xdoclet.jar xdoclet.ClientCustomer

On Windows:
	jclient -cp "%JONAS_BASE%\ejbjars\xdoclet.jar" xdoclet.ClientCustomer
	
In fact, the "-cp" option is not useful here, because classes are found in the CLASSPATH.

You should see something like this when the client is run :

Getting a UserTransaction object from JNDI
Connecting to the CustomerHome
Getting the list of existing Customer in database
Creating a new customer in database
PhoneBean ejbPostCreate number= 0476254717ID = 0
PhoneBean ejbPostCreate number= 0625785511ID = 1
Getting the list of customer with Phone number in database
Customer name is :jerome camilleri
Phone number is:Type=0  Number=0476254717
Phone number is:Type=0  Number=0625785511
Removing Customer and phone previously created in database
ClientCustomer terminated

At the end of the test all bean are removed.

4) Stop the jonas server
	jonas stop

