KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > ejbql > PhoneBean


1 package org.objectweb.jonas.jtests.beans.ejbql;
2
3 import javax.ejb.EntityContext JavaDoc;
4 import javax.naming.InitialContext JavaDoc;
5
6 public abstract class PhoneBean implements javax.ejb.EntityBean JavaDoc {
7     private SequenceSessionLocalHome seqHome = null;
8     private SequenceSessionLocal seqLocal = null;
9
10     public Object JavaDoc ejbCreate(String JavaDoc number, byte type) throws javax.ejb.CreateException JavaDoc {
11     setNumber(number);
12     setType(type);
13         int id = seqLocal.getNextNumberInSequence("Phone");
14     setId(new Integer JavaDoc(id));
15     return null;
16     }
17
18     public void ejbPostCreate(String JavaDoc number, byte type) {
19     }
20
21     // persistent fields
22

23     public abstract Integer JavaDoc getId();
24     public abstract void setId(Integer JavaDoc id);
25     public abstract String JavaDoc getNumber();
26     public abstract void setNumber(String JavaDoc number);
27     public abstract byte getType();
28     public abstract void setType(byte type);
29
30     // standard call back methods
31

32     public void setEntityContext(EntityContext JavaDoc ec){
33     try {
34         InitialContext JavaDoc cntx = new InitialContext JavaDoc( );
35         SequenceSessionLocalHome seqHome =
36         (SequenceSessionLocalHome)cntx.lookup("java:comp/env/ejb/SequenceSessionLocalHome");
37         seqLocal = seqHome.create();
38     } catch(Exception JavaDoc e) {
39         throw new javax.ejb.EJBException JavaDoc(e);
40     }
41     }
42     public void unsetEntityContext(){}
43     public void ejbLoad(){}
44     public void ejbStore(){}
45     public void ejbActivate(){}
46     public void ejbPassivate(){}
47     public void ejbRemove() throws javax.ejb.RemoveException JavaDoc{}
48
49 }
50
Popular Tags