• Post Reply Bookmark Topic Watch Topic
  • New Topic

UserTransaction question

 
Joe Joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for asking this relatively dumb question, the answer for which i could have figured out myself. MY RAD has crashed & hence i am unable to test.

What would happen if i do the below in a BMT:
UserTransaction objUserTansaction = null;
objUserTansaction.commit();

In this case will i get a NullPointerException or an IllegalStateException???
I was expecting a NullPointerException.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,
You'll definitely get a null pointer. This is due to Java. Since commit is not a static method, it gets called on the object. Which is null.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!