KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > composite > client > Client


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.tutorial.composite.client;
8
9 import org.jboss.tutorial.composite.bean.Customer;
10 import org.jboss.tutorial.composite.bean.EntityTest;
11 import org.jboss.tutorial.composite.bean.Flight;
12
13 import javax.naming.InitialContext JavaDoc;
14
15 /**
16  * Comment
17  *
18  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
19  * @version $Revision: 1.1.6.3 $
20  */

21 public class Client
22 {
23    public static void main(String JavaDoc[] args) throws Exception JavaDoc
24    {
25       InitialContext JavaDoc ctx = new InitialContext JavaDoc();
26       EntityTest test = (EntityTest) ctx.lookup(EntityTest.class.getName());
27       test.manyToManyCreate();
28
29       Flight one = test.findFlightById(new Long JavaDoc(1));
30
31       Flight two = test.findFlightById(new Long JavaDoc(2));
32
33       System.out.println("Air France customers");
34       for (Customer c : one.getCustomers())
35       {
36          System.out.println(c.getName());
37
38       }
39       System.out.println("USAir customers");
40
41       for (Customer c : two.getCustomers())
42       {
43          System.out.println(c.getName());
44       }
45
46    }
47 }
48
Popular Tags