1 27 28 package org.objectweb.jonas.jtests.beans.secured; 29 30 import javax.ejb.CreateException ; 31 import javax.ejb.EJBException ; 32 import javax.ejb.SessionBean ; 33 import javax.ejb.FinderException ; 34 import javax.ejb.SessionContext ; 35 import javax.naming.InitialContext ; 36 import javax.naming.NamingException ; 37 38 41 42 public class Session2Bean implements SessionBean { 43 public Session2Bean() { 44 } 45 46 public void ejbCreate() throws javax.ejb.CreateException { 47 } 48 49 public void setSessionContext(SessionContext sessionContext) throws EJBException { 50 } 51 52 public void ejbRemove() throws EJBException { 53 } 54 55 public void ejbActivate() throws EJBException { 56 } 57 58 public void ejbPassivate() throws EJBException { 59 } 60 61 public Entity1Local test() { 62 try { 63 Entity1LocalHome home = (Entity1LocalHome) new InitialContext ().lookup("java:comp/env/entity1"); 64 try { 65 return home.findByPrimaryKey(new Integer (1)); 66 } catch (FinderException e) { 67 return home.create(1, "value"); 68 } 69 } catch (NamingException e) { 70 throw new EJBException (e); 71 } catch (CreateException e) { 72 throw new EJBException (e); 73 } 74 } 75 } 76 | Popular Tags |