1 package org.objectweb.jonas.jtests.beans.ejbql; 2 3 import java.util.Date ; 4 5 import javax.ejb.EntityContext ; 6 import javax.naming.InitialContext ; 7 8 public abstract class CreditCardBean implements javax.ejb.EntityBean { 9 private SequenceSessionLocalHome seqHome = null; 10 private SequenceSessionLocal seqLocal = null; 11 12 public Object ejbCreate(Date exp, String numb, String name, String org) 13 throws javax.ejb.CreateException { 14 15 16 setExpirationDate(exp); 17 setNumber(numb); 18 setNameOnCard(name); 19 setCreditOrganization(org); 20 int id = seqLocal.getNextNumberInSequence("CreditCard"); 21 setId(new Integer (id)); 22 return null; 23 } 24 25 public void ejbPostCreate(Date exp, String numb, String name, String org) { 26 } 27 28 30 public abstract CustomerLocal getCustomer( ); 31 public abstract void setCustomer(CustomerLocal cust); 32 33 public abstract CreditCompanyLocal getCreditCompany( ); 34 public abstract void setCreditCompany(CreditCompanyLocal cc); 36 37 public abstract Integer getId(); 38 public abstract void setId(Integer id); 39 public abstract Date getExpirationDate(); 40 public abstract void setExpirationDate(Date date); 41 public abstract String getNumber(); 42 public abstract void setNumber(String number); 43 public abstract String getNameOnCard(); 44 public abstract void setNameOnCard(String name); 45 public abstract String getCreditOrganization(); 46 public abstract void setCreditOrganization(String org); 47 48 50 public void setEntityContext(EntityContext ec){ 51 try { 52 InitialContext cntx = new InitialContext ( ); 53 SequenceSessionLocalHome seqHome = 54 (SequenceSessionLocalHome)cntx.lookup("java:comp/env/ejb/SequenceSessionLocalHome"); 55 seqLocal = seqHome.create(); 56 } catch(Exception e) { 57 throw new javax.ejb.EJBException (e); 58 } 59 } 60 public void unsetEntityContext(){} 61 public void ejbLoad(){} 62 public void ejbStore(){} 63 public void ejbActivate(){} 64 public void ejbPassivate(){} 65 public void ejbRemove() throws javax.ejb.RemoveException {} 66 67 } 68 | Popular Tags |