50 likes | 131 Views
EJB State Diagrams. Simple Lifecycle of Session Bean. Client EJBHome EJBObject Container Context Instance Data Store. create(…). new. new. new. setSessionContext(ctxt). ejbCreate(…). ejbPassivate(). read state from instance. write state to data store. read state from data store.
E N D
Simple Lifecycle of Session Bean Client EJBHome EJBObject Container Context Instance Data Store create(…) new new new setSessionContext(ctxt) ejbCreate(…) ejbPassivate() read state from instance write state to data store read state from data store write state to instance ejbActivate()
EJB Transaction Sequence Client EJBHome EJBObject Synchron Instance Trans Svc Database javax.jts.UserTransaction.begin() business method register_synchronization(synch) afterBegin() access database regis_res() business method javax.jts.UserTransaction.commit() beforeCompletion() beforeCompletion() write updates to database commit() afterCompletion(s) afterCompletion(s)
Creating an Entity Object Client EJBHome EJBObject Synchron Instance Trans Svc Database javax.jts.UserTransaction.begin() create(args) ejbCreate(args) Bean Managed create record in database regis_res() ejbCreate(args) Container Managed create record in database regis_res() new ejbPostCreate(args) register_synchronization(synch) business method business method
Synchronizing with Data Client EJBHome EJBObject Container Instance Trans Svc Database business method business method ejbStore() write data to database Bean Managed ejbPassivate() ejbStore() extract fields Container Managed write data to database ejbPassivate() business method ejbActivate() ejbLoad() Bean Managed read data from database read data from database Container Managed write data to fields ejbLoad() business method