Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Mock Questions: transactions

 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1: Which three are true about transactions in EJB?
(Choose three.)
A) EJB 2.0 supports nested transactions.
B) EJB 2.0 allows you to specify isolation levels.
C) Message-driven beans must not use bean-managed transaction demarcation.
D) Entity beans must not use bean-managed transaction demarcation.
E) Stateful session bean state will not be rolled back if the transaction rolls back.
F) Stateful session beans that start a transaction must complete the transaction before ending a business method.
G) A message-driven bean must commit or rollback a transaction before onMessage returns.
==============================
Q2: Which two are true about bean-managed transaction demarcation?
A) A transaction used by a BMT bean MUST have been started by the bean.
B) The caller's transaction will be propogated into a BMT bean.
C) Transactions in a BMT bean do not propogate when the BMT bean calls a method on another bean.
D) A bean cannot use both CMT and BMT together.
E) BMT beans must not specify transaction attributes.
============================
OK, get your brain in gear
cheers,
Kathy
(tomorrow, I'm putting up some HARDER transaction questions )
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kathy,

Originally posted by Kathy Sierra:
Q1: Which three are true about transactions in EJB?
(Choose three.)
A) EJB 2.0 supports nested transactions.
B) EJB 2.0 allows you to specify isolation levels.
C) Message-driven beans must not use bean-managed transaction demarcation.
D) Entity beans must not use bean-managed transaction demarcation.
E) Stateful session bean state will not be rolled back if the transaction rolls back.
F) Stateful session beans that start a transaction must complete the transaction before ending a business method.
G) A message-driven bean must commit or rollback a transaction before onMessage returns.


IMO The Answer is C, D and G.
A - EJB 2.0 supports no nested transactions (see ejb 2.0 spec 17.1.2)
B - EJB 2.0 specify no isolaton leves (17.3.2 in the spec)
C - MDBs can use BMT, but must commit or rollback the transaction before returning from the onMessage() method (17.3.3).
D - Only MDB and Session Beans can use BMT (17.3.3)
E - It would be very expensive to implement such behavior in the container - The session should be passivated and stored on the start of the transaction, and reactivated on rollback - that would be a major performance killer ... also the SessionSynchronization interface would not make much sense.
F - SFSB can start a Transaction in one and end it in another business method, SLSB must end the transaction in the same business method.
G - It would not make sense to leave the transaction unfinished, MDB can be seen as a special case of a SLSB where the method invocator is a queue or a topic. See also (17.3.3). BTW This possibility is a bit vague, in the case of the CMT the MDB cannot commit or rollback the transaction (it can only mark it as rollback only or throw the EJB Exception)



Q2: Which two are true about bean-managed transaction demarcation?
A) A transaction used by a BMT bean MUST have been started by the bean.
B) The caller's transaction will be propogated into a BMT bean.
C) Transactions in a BMT bean do not propogate when the BMT bean calls a method on another bean.
D) A bean cannot use both CMT and BMT together.
E) BMT beans must not specify transaction attributes.


A, D, E
A - Since the bean manages the transactions, it must also start them.
B - That would be a conflict with the 17.1.2 - nested transactions are not supported by EJB 2.0
C - BMT and CMT are threated equally when a method on another bean is called (this option is also vague, the caller's transaction will will be suspended if the business method on another specifies RequiresNew or NotSupported transaction attribute)
D - It is not possible to define CMT or BMT on method basis - only for the whole bean
E - transaction attributes are specified only for CMT, see 17.3.6 and 17.4.1

BTW Kathy, 10x for investing your time and energy in our cert preparation, you are doing a great job!
Dragan
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer for first one D,E AND G.
2nd one E and D.
[ May 26, 2003: Message edited by: Pradeep Bhat ]
[ May 26, 2003: Message edited by: Pradeep Bhat ]
 
Dragan Milic
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
Answer for first one D,E AND G.


You are right, I forgot to change C in E after re-reading the chapter 17 of the spec.
Dragan
[ May 26, 2003: Message edited by: Dragan Milic ]
 
Kathy Sierra
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops... I said "which two" in question two, when there are THREE correct answers... good thing Dragan gave the correct answer anyway
Good job Dragan and Pradeep! And Dragan, specifying your explanation / reasoning on the answers is extremely helpful to everyone... so thank-you.
cheers,
Kathy
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what happens if client starts the transaction and calls a method of SLSB/SFSB with BMT , if....
1) the called method starts transaction and accessed db
2) the called method does not have any transaction logic, but accessed db, jms destination etc.
[ June 05, 2003: Message edited by: Kalpesh Soni ]
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what are the final answers?
Why is 'a' correct for question 2?
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic