javax.ejb

Interface EntityContext

All Superinterfaces:
EJBContext

public interface EntityContext
extends EJBContext

The main ejb context.

Method Summary

EJBLocalObject
getEJBLocalObject()
EJBObject
getEJBObject()
Object
getPrimaryKey()

Methods inherited from interface javax.ejb.EJBContext

getCallerIdentity, getCallerPrincipal, getEJBHome, getEJBLocalHome, getEnvironment, getRollbackOnly, getTimerService, getUserTransaction, isCallerInRole, isCallerInRole, lookup, setRollbackOnly

Method Details

getEJBLocalObject

public EJBLocalObject getEJBLocalObject()
            throws IllegalStateException
Usages and Demos :

View More Examples of getEJBLocalObject()
   1: import javax.ejb.EntityBean; 
   2: import javax.ejb.EntityContext; 
   3: 
   4:         ...
   5: public abstract class LineItemBean implements EntityBean {
   6:     transient private EntityContext ctx;
   7: 
   8:         ...
   9:     public void ejbPostCreate(Order order) throws CreateException {
  10:       order.getLineItems().add((LineItem)ctx.getEJBLocalObject());
  11:    }
  12:         ...
  13:     
  14:     public void setEntityContext(EntityContext ctx) { this.ctx = ctx; }

View Full Code Here
   1:    
   2:   private EntityContext entityContext;
   3:   public int otherField = 0;
   4:         ...
   5:        
   6:        EJBLocalObject ejbObject = entityContext.getEJBLocalObject();
   7:        
   8:         ...
   9:      return "EntityBean.callBusinessMethodA() called, my primaryKey is "+
  10:             entityContext.getPrimaryKey().toString();
  11:   }
  12:         ...
  13:      {
  14:         EnterpriseEntityLocalHome home = (EnterpriseEntityLocalHome)entityContext.getEJBLocalObject().getEJBLocalHome();

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.RemoveException;
   4:         ...
   5: 
   6:    private EntityContext   mEntityContext;
   7: 
   8:         ...
   9:       Object key = mEntityContext.getPrimaryKey();
  10:       EJBLocalObject local = mEntityContext.getEJBLocalObject();
  11:       Object lkey = local.getPrimaryKey();
  12:         ...
  13:       log.info("key: "+key+", lkey: "+lkey+", local: "+local);
  14:       return (Object)mEntityContext.getEJBLocalObject().getPrimaryKey();

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.FinderException;
   4:         ...
   5:     
   6:     private EntityContext ejbctx;
   7:     private CodeLocalHome codeHome;
   8:         ...
   9: 
  10:     public void setEntityContext(EntityContext ctx) {
  11:         ejbctx = ctx;
  12:         ...
  13:         Collection c = getHPDefinition();
  14:         HPLocal hp = (HPLocal) ejbctx.getEJBLocalObject();

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.FinderException;
   4:         ...
   5:     private static final Logger log = Logger.getLogger(FileSystemBean.class);
   6:     private EntityContext ctx;
   7: 
   8:         ...
   9: 
  10:     public void setEntityContext(EntityContext ctx) 
  11:     throws EJBException, RemoteException {
  12:         ...
  13:         if (next != null) {
  14:             String nextPath = next.isIdentical(ctx.getEJBLocalObject()) 

View Full Code Here

getEJBObject

public EJBObject getEJBObject()
            throws IllegalStateException
Usages and Demos :

View More Examples of getEJBObject()
   1:    
   2:   private EntityContext entityContext;
   3:   public int otherField = 0;
   4:         ...
   5:        
   6:        EJBLocalObject ejbObject = entityContext.getEJBLocalObject();
   7:        
   8:         ...
   9:      
  10:      EJBObject ejbObject = entityContext.getEJBObject();
  11:      
  12:         ...
  13:      
  14:      EJBObject ejbObject = entityContext.getEJBObject();

View Full Code Here
   1:    org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(getClass());
   2:   private EntityContext entityContext;
   3:   public String name;
   4:         ...
   5:        
   6:        EJBObject ejbObject = entityContext.getEJBObject();
   7:        
   8:         ...
   9:        
  10:        EJBObject ejbObject = entityContext.getEJBObject();
  11:        
  12:         ...
  13:      return "EntityBean.callBusinessMethodA() called, my primaryKey is "+
  14:             entityContext.getPrimaryKey().toString();

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.RemoveException;
   4:         ...
   5: 
   6:    private EntityContext   mEntityContext;
   7: 
   8:         ...
   9:       {
  10:          return (Object)mEntityContext.getEJBObject().getPrimaryKey();
  11:       }
  12:         ...
  13: 
  14:    public void setEntityContext(EntityContext ctx)

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.RemoveException;
   4:         ...
   5: 
   6:    private EntityContext ctx;
   7: 
   8:         ...
   9:       this.id = id;
  10:       Reentrant me = (Reentrant)ctx.getEJBObject();
  11:       Connection c = null;
  12:         ...
  13: 
  14:    public void setEntityContext(EntityContext ctx)

View Full Code Here
   1: import javax.ejb.EJBException;
   2: import javax.ejb.EntityContext;
   3: import javax.naming.InitialContext;
   4:         ...
   5:         extends PersonBean {
   6:     private EntityContext ctx;
   7: 
   8:         ...
   9:             AccountHome home = (AccountHome) new InitialContext().lookup("java:comp/env/ejb/bank/Account");
  10:             return home.findByOwner((Customer) ctx.getEJBObject());
  11:         }
  12:         ...
  13:             AddressLocalHome home = (AddressLocalHome) new InitialContext().lookup("java:comp/env/ejb/bank/Address");
  14:             return home.findByOwner((Customer) ctx.getEJBObject());

View Full Code Here

getPrimaryKey

public Object getPrimaryKey()
            throws IllegalStateException
Usages and Demos :

View More Examples of getPrimaryKey()
   1: 
   2: import javax.ejb.EntityContext;
   3: import javax.naming.*;
   4:         ...
   5:         MockControl entityContextControl =
   6:             MockControl.createNiceControl(EntityContext.class);
   7: 
   8:         ...
   9:         EntityContext mockEntityContext =
  10:             (EntityContext) entityContextControl.getMock();
  11:         ...
  12: 
  13:         mockEntityContext.getPrimaryKey();

View Full Code Here
   1:    
   2:    EntityContext ctx = null;
   3: 
   4:         ...
   5: 
   6:    public void setEntityContext (EntityContext ctx)
   7:       throws EJBException, RemoteException
   8:         ...
   9:    {
  10:       log.debug("setEntityContext ('" + ctx.getPrimaryKey() + "') called");
  11:       this.ctx = ctx;

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.RemoveException;
   4:         ...
   5: 
   6:    private EntityContext ctx;
   7: 
   8:         ...
   9:    {
  10:       log.debug("removed: " + ctx.getPrimaryKey() );
  11:    }
  12:         ...
  13: 
  14:    public void setEntityContext(EntityContext ctx)

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.FinderException;
   4:         ...
   5: 
   6:    private EntityContext ctx;
   7: 
   8:         ...
   9:    {
  10:       log.debug( "removed: " + ctx.getPrimaryKey() );
  11:    }
  12:         ...
  13:    
  14:    public void setEntityContext(EntityContext ctx)

View Full Code Here
   1: import javax.ejb.EntityBean;
   2: import javax.ejb.EntityContext;
   3: import javax.ejb.FinderException;
   4:         ...
   5: 
   6:    private EntityContext ctx;
   7: 
   8:         ...
   9:    {
  10:       log.debug("removed: " + ctx.getPrimaryKey() );
  11:    }
  12:         ...
  13: 
  14:    public void setEntityContext(EntityContext ctx)

View Full Code Here