KickJava   Java API By Example, From Geeks To Geeks.

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

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