编程语言

img GOALSTAR

用JBUILD9.0开发EJB的一些步骤和方法

发表于2004/10/11 17:30:00  1229人阅读

分类: JAVA 编程

<script type="text/javascript"><!-- google_ad_client = "pub-2016433482135581"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_channel =""; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

1.  Open the EJB Module and Create CMP 2.0 Entity Bean

 

2..Right Click The CMP ---- Select Lanuch DTO/Façade Wizard

The Wizard will Auto Create some .java Include

For Example:  My module name is ContractSample

DTO

              ContractSampleDto.java

              ContractSampleDtoAssemble.java

EJB

       Entity

              ContractSample.java

              ContractSampleBean.java

              ContractSampleHome.java

       Session

              ContractSampleFacade.java

              ContractSampleFacadeBean.java

              ContractSampleFacadeHome.java

              ContractSampleFacadeLocal.java

              ContractSampleFacadeLocalHome.java

IMPL

              ContractSampleDelegate.java

 

 

DTO

              ContractSampleDto.java

              ContractSampleDtoAssemble.java

Explain:

       Using Value Object Pattern

       Efficiently transfer remote , fine-grained data by sending a coarse-grained view of the data

EJB

       Entity

              ContractSample.java

              ContractSampleBean.java

              ContractSampleHome.java

       Session

              ContractSampleFacade.java

              ContractSampleFacadeBean.java

              ContractSampleFacadeHome.java

              ContractSampleFacadeLocal.java

              ContractSampleFacadeLocalHome.java

Explain

       Provide a unified , workflow-oriented interface to a set of enterprise beans

 

       ContractSampleFacadeBean.java

              Write the business logic code in ContractSampleFacadeBean.java

ContractSampleFacadeBean implement Remote and Local Interface method

             

       ContractSampleFacade.java  

              Provide remote interface

       ContractSampleFacadeLocal.java

              Provide Local Interface

ContractSampleFacade.java

              Remote create() Mehtod

       ContractSampleFacadeLocal.java

              Local create() method

 

IMPL

              ContractSampleDelegate.java

              The Business Logic Mothod Interface

              The Client used ContractSampleDelegate’s Object transfer business logic method()

 

 

 

 

 

 

 

In Common Use Method of EJB

 

1NewForm add

----------------------------Action--------------------------------

OrderDirectFacadeUtil.getLocalHome().create().create(data);

//OrderDirectFacadeLocalHome home = OrderDirectFacadeUtil.getLocalHome();

//OrderDirectFacadeLocal order = home.create();

//OrderDirectData orderdata = order.create(data);

 

-------------------------OrderDirectFacadeEJB-----------------------

public OrderDirectData create(OrderDirectData cd)

      

              throws javax.ejb.CreateException, javax.naming.NamingException {

              return getLocalHome().create(cd).getData();

       }

 

 

Delete

----------------------------Action--------------------------------

 

Boolean isDel = OrderRecordFacadeUtil.getLocalHome().create().deleteOrderRecord(data);

 

-------------------------OrderDirectFacadeEJB-----------------------

 

public boolean deleteOrderRecord(OrderRecordData data) throws Exception {

 

       //OrderRecordUtil.getLocalHome().findByPrimaryKey(data.getPrimaryKey()).remove();

       this.getLocalHome().findByPrimaryKey(data.getPrimaryKey()).remove();

      

}

 

 

Modify

----------------------------Action--------------------------------

Fill the form’s data to DAO

OrderRecordFacadeUtil.getLocalHome().create().updateOrderRecord(data);

 

-------------------------OrderDirectFacadeEJB-----------------------

 

 

阅读全文
0 0

相关文章推荐

img
取 消
img