• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In CMT when does a transaction actually commit

 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Hideki Mae
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3332
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic