
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:
-----------------------------------
Before compiling and running this example, the installation and configuration
of SDOCLET have to be done and the environment variable XDOCLET_LIB must be initialized.

you must had install before xdoclet >= 1.2 (see : http://xdoclet.sourceforge.net/)
and set the $xdocletdir.

Using target ejbdoclet :
ant ejbdoclet

You should have this return :
ejbdoclet:
[ejbdoclet] (XDocletMain.start                   45  ) Running <remoteinterface/>
[ejbdoclet] Generating Remote interface for 'xdoclet.CustomerBean'.
[ejbdoclet] (XDocletMain.start                   45  ) Running <localinterface/>
[ejbdoclet] Generating Local interface for 'xdoclet.CustomerBean'.
[ejbdoclet] (XDocletMain.start                   45  ) Running <homeinterface/>
[ejbdoclet] Generating Home interface for 'xdoclet.CustomerBean'.
[ejbdoclet] (XDocletMain.start                   45  ) Running <localhomeinterface/>
[ejbdoclet] Generating Local Home interface for 'xdoclet.CustomerBean'.
[ejbdoclet] (XDocletMain.start                   45  ) Running <deploymentdescriptor/>
[ejbdoclet] Generating EJB deployment descriptor (ejb-jar.xml).
[ejbdoclet] (XDocletMain.start                   45  ) Running <jonas/>
[ejbdoclet] (TemplateSubTask.engineStarted       791 ) Generating output 'jonas-ejb-jar.xml' using template file 'jar:fil
e:D:\jonas\xdoclet\xdoclet\target\lib\xdoclet-objectweb-module-1.2b3-dev.jar!/xdoclet/modules/objectweb/jonas/ejb/resourc
es/jonas.xdt'.

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

