wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes In CMT when does a transaction actually commit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "In CMT when does a transaction actually commit" Watch "In CMT when does a transaction actually commit" New topic
Author

In CMT when does a transaction actually commit

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi

In CMT when does the transaction actually commit. Is it when the business method completes or
does it depend upon the deployment descriptor <trans-attribute> tag.
If that is the case when will the transaction actually commit
if we have
Required
RequiredNew
Mandatory
Rgrds
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
For all transaction attributes necessitating a valid transaction context (Required, RequiresNew and Mandatory), "The Container attempts to commit the transaction when the business method has completed. The container performs the commit protocol before the method result is sent to the client." (EJB 2.0 spec, Sections 17.6.2.2, 17.6.2.4, 17.6.2.5)
I hope it helps


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Hideki Mae
Greenhorn

Joined: Oct 19, 2004
Posts: 14
I have a question regarding CMT and transactions. I use JBoss-3.2.4 with Oracle 9i. My question is how long does it take for the databse to get updated when you use CMT? I used CMT for my web project and I noticed that it can take a long time (~30 minutes to ~50 minutes) before the transaction that was executed by the CMT gets reflected on the Oracle database. Is there some configuration setting that I can change to make the database get updated faster (preferrably within a minute).
The codes execute correctly and I don't see anything in the server.log that indicates an error. It just takes a long time for the database to get updated. My web page has a table that will display the contents of my bean and it does show the newly added information.
Thanks in advance for any help you can give me.
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3199
    
    5
Originally posted by Hideki Mae:
I have a question regarding CMT and transactions. I use JBoss-3.2.4 with Oracle 9i. My question is how long does it take for the databse to get updated when you use CMT? I used CMT for my web project and I noticed that it can take a long time (~30 minutes to ~50 minutes) before the transaction that was executed by the CMT gets reflected on the Oracle database. Is there some configuration setting that I can change to make the database get updated faster (preferrably within a minute).
The codes execute correctly and I don't see anything in the server.log that indicates an error. It just takes a long time for the database to get updated. My web page has a table that will display the contents of my bean and it does show the newly added information.
Thanks in advance for any help you can give me.


That's actually a JBoss-specific problem (better to say 'feature'), it does not always update DB (don't synchronize CMP-DB) for the reason of saving resources.

Try to play with commit options A, B, C, D in standardjboss.xml (or jboss.xml in your EJB jar):




Commit-option A, this bean is cached and is available between transactions. Normally this assumes that any database access is done through the container.

Commit-option B, this is JBoss' default and is also known as pessimistic locking. The bean is locked in a transaction until the transaction commits or rolls back. This is true for read-only transactions as well.

Commit-option C, the bean passivates at the end of a transaction and is locked during a transaction.

Commit-option D, a background thread periodically executes ejbLoad() on beans in the cache and this option is the same as commit-option A otherwise.

regards,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: In CMT when does a transaction actually commit
 
Similar Threads
EJB3 is it possible to mix BMT and CMT?
More on Exceptions !
Some CMT and BMT doubts in EJB?
setRollBack() Query
question about BMT calling CMT