Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in enthuware mock questions

 
krishna bulusu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Following is the question:
Given the following method of a stateful session bean -

public void processAccount()
{
...
EntityTransaction et = em.getTransaction();
et.setRollbackOnly(); //2
...
}

What might be a possible outcome as a result of calling line //2 ...
1)The transaction would have been rollbacked when call in //2 returns.
2)An IllegalStateException might be thrown.
3)The transaction cannot be committed.
4)et.setRollbackOnly(false) may be called to clear rollbackonly status.
My question is that there is no such method setRollbackOnly() in the EntityTransaction interface. How come this code would compile?
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by krishna bulusu:
My question is that there is no such method setRollbackOnly() in the EntityTransaction interface. How come this code would compile?


[edit]I edited this post 'cause my previous answer WAS wrong[/edit]

I thought you were right and that the method didn't exist (I can swear I took a look at the javadoc and the method wasn't there). However, after taking a more careful look, the method is there.

On a second (or third) thought, I might have taken a look at the wrong class', UserTransaction, javadocs.
[ September 08, 2008: Message edited by: Sergio Tridente ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic