| LocalHomeインターフェース | 
    
    
      package refactor; 
       
      import javax.ejb.*; 
       
      public interface MovieHome extends javax.ejb.EJBLocalHome { 
        public Movie create(String title, int pricecode) throws CreateException; 
        public Movie findByPrimaryKey(String title) throws FinderException; 
      } | 
    
    
      | Localインターフェース | 
    
    
      package refactor; 
       
      public interface Movie extends javax.ejb.EJBLocalObject { 
        public String getTitle(); 
        public void setPricecode(int
      pricecode); 
        public int getPricecode(); 
        public Price getPrice(); // Priceエンティティビーンへのリレーションシップ 
        public double getCharge(int daysRented); 
        public int getFrequentRenterPoints(int
      daysRented); 
      } | 
    
    
      | Beanクラス | 
    
    
      package refactor; 
       
      import javax.ejb.*; 
       
      abstract public class MovieBean implements EntityBean { 
        EntityContext entityContext; 
        public java.lang.String ejbCreate(java.lang.String title, int pricecode) throws
      CreateException { 
          setTitle(title); 
          setPricecode(pricecode); 
          return null; 
        } 
        public void ejbPostCreate(java.lang.String
      title, int pricecode) throws CreateException
      { 
        } 
        public void ejbRemove() throws
      RemoveException { 
        } 
        public abstract void setTitle(java.lang.String
      title); 
        public abstract void setPricecode(int pricecode); 
        public abstract void setPrice(refactor.Price
      price); 
        public abstract java.lang.String getTitle(); 
        public abstract int getPricecode(); 
        public abstract refactor.Price getPrice(); // Priceエンティティビーンへのリレーションシップ 
        public void ejbLoad() { 
        } 
        public void ejbStore() { 
        } 
        public void ejbActivate() { 
        } 
        public void ejbPassivate() { 
        } 
        public void unsetEntityContext()
      { 
          this.entityContext
      = null; 
        } 
        public void setEntityContext(EntityContext
      entityContext) { 
          this.entityContext
      = entityContext; 
        } 
       
        /** 
          * @param daysRented 
          * @return 
          */ 
        public double getCharge(int daysRented) { 
          return getPrice().getCharge(daysRented);
      // Priceエンティティビーンに委譲 
        } 
       
        /** 
          * @param daysRented 
          * @return 
          */ 
        public int getFrequentRenterPoints(int daysRented) { 
          return getPrice().getFrequentRenterPoints(daysRented); // Priceエンティティビーンに委譲 
        } 
      } |