Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, v1.1 - Sun Microsystems.pdf
Скачиваний:
11
Добавлен:
24.05.2014
Размер:
1.62 Mб
Скачать

Sun Microsystem Inc

Object interaction diagrams

Enterprise JavaBeans v1.1, Final Release

Entity Bean Component Contract

9.5 Object interaction diagrams

This section uses object interaction diagrams to illustrate the interactions between an entity bean instance and its container.

9.5.1 Notes

The object interaction diagrams illustrate a box labeled “container-provided classes.” These classes are either part of the container or are generated by the container tools. These classes communicate with each other through protocols that are container implementation specific. Therefore, the communication between these classes is not shown in the diagrams.

The classes shown in the diagrams should be considered as an illustrative implementation rather than as a prescriptive one

135

11/24/99

Sun Microsystems Inc.

Entity Bean Component Contract

Enterprise JavaBeans v1.1, Final Release

Object interaction diagrams

9.5.2 Creating an entity object

Figure 26 OID of Creation of an entity object with bean-managed persistence

container-provided classes

client

EJB

EJB

container entity

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

javax.transaction.UserTransaction.begin()

create(args)

ejbCreate(args)

create representation in DB

register resource manager

new

ejbPostCreate(args)

new

registerSynchronization(synchronization)

business method

business method

11/24/99

136

Sun Microsystem Inc

Object interaction diagrams

Enterprise JavaBeans v1.1, Final Release

Entity Bean Component Contract

Figure 27 OID of creation of an entity object with container-managed persistence

container-provided classes

client

EJB

EJB container

instance

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

javax.transaction.UserTransaction.begin()

create(args)

ejbCreate(args)

extract container-managed field

create entity representation in DB

register resource manager

new

ejbPostCreate(args)

new

registerSynchronization(synchronization)

business method

business method

137

11/24/99

Sun Microsystems Inc.

Entity Bean Component Contract

Enterprise JavaBeans v1.1, Final Release

Object interaction diagrams

9.5.3 Passivating and activating an instance in a transaction

Figure 28 OID of passivation and reactivation of an entity bean instance with bean-managed persistence

container-provided classes

client

EJB

EJB

container instance

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

business method

business method

ejbStore()

write state to DB

ejbPassivate()

business method

ejbActivate()

ejbLoad()

read state from DB

business method

business method

business method

11/24/99

138

Sun Microsystem Inc

Object interaction diagrams

Enterprise JavaBeans v1.1, Final Release

Entity Bean Component Contract

Figure 29 OID of passivation and reactivation of an entity bean instance with CMP

container-provided classes

client

EJB

EJB

container instance

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

business method

business method

ejbStore()

extract container-managed fields update entity state in DB

ejbPassivate()

business method

ejbActivate()

read entity state from DB

set container-managed fields

ejbLoad()

business method

business method

business method

139

11/24/99