Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Beat Question

 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Stateful
public class TestBean implements Test, TimedObject
{
...
@TransactionAttribute(MANDATORY)
public void ejbTimeout(Timer timer)
{
}
}
Which of the following statements are true?
a. Only stateless session bean can implement the TimedObject interface.
b. It is not legal to define the transaction attribute 'MANDATORY' on the ejb timeout
callback method.
c. None of the above


Can a stateful bean implement TimedObject? please confirm

Thanks
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to a)
Only the SLSBs, MDBs an 2.1 Entity beans can use TimerService.

Accroding to b)
Callback timeout methods can have only the following transaction attributes: REQUIRED, REQUIRES_NEW, NOT_SUPPORTED. Therefore is not legal to define the MANDATORY propagation level for this method.




 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means answer to this question will be c
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amirr Rafique wrote:That means answer to this question will be c


Nope. In b) It says that is "not legal to define the transaction attribute 'MANDATORY' on the ejb timeout
callback method. " which is true. In my opinion the correct answer is b).
 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krzysztof Koziol wrote:
Amirr Rafique wrote:That means answer to this question will be c


Nope. In b) It says that is "not legal to define the transaction attribute 'MANDATORY' on the ejb timeout
callback method. " which is true. In my opinion the correct answer is b).


but the question is using TimedObject interface on @Statefull session beans which is not right? is it some typo error in java beat question?
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic