• Post Reply Bookmark Topic Watch Topic
  • New Topic

transaction rolling back  RSS feed

 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using container managed transactions in weblogic 7.0
A) in few methods i have transaction attribute as required
B) in few methods i have transaction attribute as supports
thus sometimes a method firing only select queris (methods in B) may be in transaction if called from A, or sometimes not in transaction if called directly
on getting any exception, i want to rollback transaction
using SessionContext.getUserTransaction() gives illegal state exception
sessionContext.setRollBackOnly() gives illegal state exception
the j2ee docs says that for container managed transcations THESE METHODS CANNOT BE CALLED
now, the question is how do i know in my ejb code whether current code is running under transactions or not !
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know where you saw that these methods are not supperted?
I use cantainer transactions all the time, and using setRollBackOnly never gave me any trouble...
 
Kalpesh Soni
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IllegalStateException comes, when there is NO transaction !
What is the transaction attribute , that you are using?
If you are using "Required" then u wont get any error
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!