KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > joininheritance > 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.joininheritance.Client;
8
9 import org.jboss.tutorial.joininheritance.bean.Pet;
10 import org.jboss.tutorial.joininheritance.bean.PetDAO;
11
12 import javax.naming.InitialContext JavaDoc;
13
14 import java.util.List JavaDoc;
15
16 /**
17  * Comment
18  *
19  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
20  * @version $Revision: 1.2.6.3 $
21  */

22 public class Client
23 {
24    public static void main(String JavaDoc[] args) throws Exception JavaDoc
25    {
26       InitialContext JavaDoc ctx = new InitialContext JavaDoc();
27       PetDAO dao = (PetDAO) ctx.lookup(PetDAO.class.getName());
28
29       dao.createCat("Toonses", 15.0, 9);
30       dao.createCat("Sox", 10.0, 5);
31       dao.createDog("Winnie", 70.0, 5);
32       dao.createDog("Junior", 11.0, 1);
33
34       List JavaDoc l = dao.findByWeight(14.0);
35       for (Object JavaDoc o : l)
36       {
37          System.out.println(((Pet) o).getName());
38       }
39    }
40 }
41
Popular Tags