1 package org.objectweb.jonas.jtests.beans.ejbql; 2 3 import javax.ejb.EntityContext ; 4 import javax.naming.InitialContext ; 5 6 public abstract class PhoneBean implements javax.ejb.EntityBean { 7 private SequenceSessionLocalHome seqHome = null; 8 private SequenceSessionLocal seqLocal = null; 9 10 public Object ejbCreate(String number, byte type) throws javax.ejb.CreateException { 11 setNumber(number); 12 setType(type); 13 int id = seqLocal.getNextNumberInSequence("Phone"); 14 setId(new Integer (id)); 15 return null; 16 } 17 18 public void ejbPostCreate(String number, byte type) { 19 } 20 21 23 public abstract Integer getId(); 24 public abstract void setId(Integer id); 25 public abstract String getNumber(); 26 public abstract void setNumber(String number); 27 public abstract byte getType(); 28 public abstract void setType(byte type); 29 30 32 public void setEntityContext(EntityContext ec){ 33 try { 34 InitialContext cntx = new InitialContext ( ); 35 SequenceSessionLocalHome seqHome = 36 (SequenceSessionLocalHome)cntx.lookup("java:comp/env/ejb/SequenceSessionLocalHome"); 37 seqLocal = seqHome.create(); 38 } catch(Exception e) { 39 throw new javax.ejb.EJBException (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 {} 48 49 } 50 | Popular Tags |