aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes CMP versus CMT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "CMP versus CMT" Watch "CMP versus CMT" New topic
Author

CMP versus CMT

Nath White
Greenhorn

Joined: Feb 18, 2003
Posts: 3
I understand what Container/Bean Managed Persistence are about, but what are Container/Bean Managed Transactions?
According to the Whizz Labs tests, CMP and CMT are different things.
Additionally, it seems to suggest that CMT might be necessary even if no data is being persisted. What kind of transaction is required if there is no data persistence??
Shankar Ranganathan
Ranch Hand

Joined: Sep 19, 2001
Posts: 71
I will tell in you short what is CMT.
When it is CMT all your commits and rollback are taken care of by container or in other words you don't have to explicitly write commit and rollback,in the case of bmt you have to do that.
My suggestion you can thru the ejb spec or edroman book for further details
Shankar


Shankar<br />Post mock questions in<br /><a href="http://groups.yahoo.com/group/scea_mock" target="_blank" rel="nofollow">http://groups.yahoo.com/group/scea_mock</a>
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
CMP - Container Managed Persistence
  • Entity beans are mapped to tables using mapping tools provided by the container.
  • Container takes care of generating SQL statements and persisting bean state to database.
  • Programmer will not implement ejbLoad() and ejbStore().
  • No fine-grained control over SQL statements.
  • Rapid development, heavy deployment activities.
  • Alternative - BMP - Bean Managed Persistence.


  • CMT - Container Managed Transaction(s)
  • Where a bean method is transaction enabled in the deployment descriptor, container takes care of initiating, propagating, commiting and rolling back the transaction.
  • Alternative - BMT - Bean Managed Transaction(s).
  • Uses Java Transaction Service(JTS)
  • Programmer will not use explicit JTA transaction calls in the code.
  • Less error prone compared to BMT.


  • Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
    Rama Raghavan
    Ranch Hand

    Joined: Aug 22, 2001
    Posts: 116
    CMT
    - Transaction in Entity beans are (almost) always Container managed
    - Transactions in Session beans may be bean or container managed
    Rama
    Chris Mathews
    Ranch Hand

    Joined: Jul 18, 2001
    Posts: 2712
    Originally posted by Rama Raghavan:
    - Transaction in Entity beans are (almost) always Container managed

    Actually, there is no almost about it. Entity Beans will always be CMT.
    Section 17.3.1 of the EJB 2.0 Specification
    An Entity Bean must always be designed with container-managed transaction demarcation.
    Nath White
    Greenhorn

    Joined: Feb 18, 2003
    Posts: 3
    Actually, there is no almost about it. Entity Beans will always be CMT.

    In EJB 1.0, session and entity beans can both be BMT.
    In EJB 1.1, only session beans can be BMT.
    In either case only beans set to have BMP can declare BMT. (both persistence and transaction must be declared at the bean level rather than method level)
    phew! Thanks for the pointers guys. When I first read about it in my EJB book I didn't see the distinction, but it all makes sense now.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: CMP versus CMT