Sunday 2 October 2016

OCEJBCD -10. Implementing transactions

OCEJBCD (SCBCD) - 1Z0-895 - Enterprise JavaBeans Developer Certification

10.1. Describe transaction demarcation management

JTA (Java Transaction API).

Transaction demarcation involves indicating when a transaction begin and ends.

There are three kind of demarcation management:

  • Bean managed
  • Container managed (by default)
  • Client managed

10.2. Implement CMT

CMT (Container Managed transaction)

Transaction attributes

Transactions attributes can be used at class or method level.

  • Required
@TransactionAttribute(REQUIRED)
Start transaction or continue with client transaction.
  • RequiresNew
@TransactionAttribute(REQUIRES_NEW)
Start new transaction (stop client and resume later).


  • Mandatory
@TransactionAttribute(MANDATORY)
Always with client transaction, if not throws an exception


  • Not supported
@TransactionAttribute(NOT_SUPPORTED)
No transaction (if client running within trans stop and resume later)


  • Supports
@TransactionAttribute(SUPPORTS)
Bean runs within client transaction if related only.


  • Never
@TransactionAttribute(NEVER)



10.3. Interact programmatically with an ongoing CMT transaction

A transaction will rollback automatically in CMT when a system exception ocurrs. It can be invoked by setRollbackOnly() method.

Methods not allowed in CMT are ( commit, rollback, getUserTransaction...)

10.4. Implement BMT Apply transactions to messaging

@TransactionManagement(BEAN)

Use of commit, rollback, getUserTransaction(setTransactionTimeout..etc)
Not allowed get/setRollbackOnly()

OCEJBCD (SCBCD) - 1Z0-895 - Enterprise JavaBeans Developer Certification

No comments:

Post a Comment