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

Sun Microsystems Inc.

EJB 1.1 Entity Bean Component Contract for Container Managed PersistenceEnterprise JavaBeans 2.0, Public Draft Object interaction

13.2.4 Committing a transaction

Figure 53 OID of transaction commit protocol for an entity bean instance with EJB 1.1 container-managed persistence

container-provided classes

client

EJB

EJB

container entity

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

javax.transaction.UserTransaction.commit()

 

beforeCompletion()

 

ejbStore()

 

extract container-managed fields

 

update entity state in DB

 

prepare

 

commit

 

afterCompletion(status)

Option A: mark “not registered”

Option B:

mark “invalid state”

Option C:

ejbPassivate()

5/31/00

272

Sun Microsystems Inc

Object interaction diagrams

Enterprise JavaBeans 2.0, Public Draft EJB 1.1 Entity Bean Component Contract for

13.2.5 Starting the next transaction

The following diagram illustrates the protocol performed for an entity bean instance with EJB 1.1 con- tainer-managed persistence at the beginning of a new transaction. The three options illustrated in the diagram correspond to the three commit options in the previous subsection.

273

5/31/00

Sun Microsystems Inc.

EJB 1.1 Entity Bean Component Contract for Container Managed PersistenceEnterprise JavaBeans 2.0, Public Draft Object interaction

Figure 54 OID of start of transaction for an entity bean instance with EJB 1.1 container-managed persistence

container-provided classes

client

EJB

EJB

container entity

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

javax.transaction.UserTransaction.begin()

business method

Option A:

do nothing

 

Option B:

read state from DB

register resource manager

 

 

set container managed fields

 

ejbLoad()

Option C:

ejbActivate()

 

read entity state from DB

 

register resource manager

 

set container managed fields

 

ejbLoad()

 

new

 

registerSynchronization(synchronization)

 

business method

business method

business method

5/31/00

274

Sun Microsystems Inc

Object interaction diagrams

Enterprise JavaBeans 2.0, Public Draft EJB 1.1 Entity Bean Component Contract for

13.2.6 Removing an entity object

Figure 55 OID of removal of an entity bean object with EJB 1.1 container-managed persistence

container-provided classes

client

EJB

EJB

container entity

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

remove()

ejbRemove()

remove representation in DB

275

5/31/00