Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5991875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:27:04+00:00 2026-05-22T23:27:04+00:00

I have a @Stateless EJB using container managed transaction. Is there a way to

  • 0

I have a @Stateless EJB using container managed transaction. Is there a way to access the “status” of javax.transaction.UserTransaction? That is, calling UserTransaction.getStatus() inside the bean methods?

I know access to UserTransaction is prohibited in container managed beans, but I would like to know, is there any other way to get access to getStatus() method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:27:05+00:00Added an answer on May 22, 2026 at 11:27 pm

    I don’t think you’ve understood the responsibility of the UserTransaction class. It does not exist to provide you with access to the current running transaction. It is used to initiate any communication with the Transaction Manager of the container, especially for beginning and ending bean-managed transactions; that is why you must not access it from a container managed transaction context.

    I would like to know, is there any other way to get access to getStatus() method?

    No, one cannot, atleast not using the EJB APIs. One can at most, use EJB interceptors to log the fact that EJB methods have been invoked. You’ll need to be quite intelligent to track state across calls, and then infer the transaction state.

    If you are not averse to use Container specific APIs, you might be able to access the underlying transaction. Be forewarned, for the approach listed below might not work if you do not know how to use it, or if the container prohibits you from doing so. The mechanism described below is how the SpringFramework gains access to the JTA transaction manager and is able to create and manage transactions.

    In the case of Oracle WebLogic, one can obtain a reference to the TranactionHelper class, which can be used to obtain a reference to the current transaction associated with the thread, whose status can be obtained. I would point to the sources of the Transaction SPI for JTA in the Spring framework, if you need to pursue this course for other application servers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a @Stateless EJB with a @WebService interface, using container managed transactions, meaning
using ejb 3.1, servlet 3.0 (glassfish server v3) Scenario: I have MDB that listen
We have some JavaEE5 stateless EJB bean that passes the injected EntityManager to its
I have a stateless EJB that acceses my database. I need this bean in
So I'm using container managed transactions in OpenEJB and Hibernate and I have a
Starting a new project using EJB 3 / JPA, mainly stateless session beans and
Obviously using stateless EJB beans in an entity bean smells, but please consider a
I have an @Stateless EJB method in which I delete some entries from a
I am using JPA in a Glassfish Container. I have the following Modell (not
I have a stateless bean with bean-managed transactions, and a method like this: @Stateless

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.