1 package org.objectweb.jonas.jtests.beans.ejbql; 2 3 import javax.ejb.CreateException ; 4 import javax.ejb.EntityContext ; 5 import javax.ejb.RemoveException ; 6 import javax.naming.InitialContext ; 7 8 public abstract class CreditCompanyBean implements javax.ejb.EntityBean { 9 10 private SequenceSessionLocal seqLocal = null; 11 12 public Integer ejbCreate(String name) throws CreateException { 13 int id = seqLocal.getNextNumberInSequence("CreditCompany"); 14 setId(new Integer (id)); 15 setName(name); 16 setNum(id); 17 return null; 18 } 19 20 public void ejbPostCreate( String name) { 21 } 22 23 25 public abstract void setId(Integer id); 26 public abstract Integer getId(); 27 public abstract void setName(String name); 28 public abstract String getName( ); 29 public abstract void setNum(int num); 30 public abstract int getNum( ); 31 32 34 public abstract AddressLocal getAddress( ); 35 public abstract void setAddress(AddressLocal cust); 36 37 39 public void setEntityContext(EntityContext ec){ 40 try { 41 InitialContext cntx = new InitialContext ( ); 42 SequenceSessionLocalHome seqHome = 43 (SequenceSessionLocalHome)cntx.lookup("java:comp/env/ejb/SequenceSessionLocalHome"); 44 seqLocal = seqHome.create(); 45 } catch(Exception e) { 46 throw new javax.ejb.EJBException (e); 47 } 48 } 49 public void unsetEntityContext(){} 50 public void ejbLoad(){} 51 public void ejbStore(){} 52 public void ejbActivate(){} 53 public void ejbPassivate(){} 54 public void ejbRemove() throws RemoveException {} 55 56 } 57 | Popular Tags |