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

  • SEARCH
  • Home
  • 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 3332706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:42:59+00:00 2026-05-17T23:42:59+00:00

I have an @Stateless EJB method in which I delete some entries from a

  • 0

I have an @Stateless EJB method in which I

  1. delete some entries from a database
    using JPA remove()‘s
  2. throw an Exception that is annotated as @ApplicationException(rollback=true)

I have no other transaction-specific annotations for the method (I set @TransactionAttribute(TransactionAttributeType.REQUIRED) but that should be the default anyway!). Transactions are container managed. JPA provider is EclipseLink.

And still, the transaction is not rolled back when the exception is thrown. Eg. the entries that I deleted from the database before the rollback don’t come back. Btw. I call entityManager.flush() before the throw, can it cause such behaviour (it shouldn’t)?

I also tried to call SessionContext.setRollbackOnly(), with the same result.

How can I debug this problem?

I’m using Glassfish v3 and Netbeans for debugging, but I’d be equally happy with println’s I just don’t know where to put them…

  • 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-17T23:43:00+00:00Added an answer on May 17, 2026 at 11:43 pm

    I have an @Stateless EJB method in which I (…)

    Just to clarify how do you get the EntityManager?

    (…) I set @TransactionAttribute(TransactionAttributeType.REQUIRED

    Indeed, this is the default and shouldn’t be required anyway.

    And still, the transaction is not rolled back when the exception is thrown. Eg. the entries that I deleted from the database before the rollback don’t come back.

    Hmm, that’s very strange and unexpected.

    Btw. I call entityManager.flush() before the throw, can it cause such behaviour (it shouldn’t)?

    No, flush != commit

    I also tried to call SessionContext.setRollbackOnly(), with the same result.

    Well, still unexpected (but at least consistent…).

    I’m using Glassfish v3 and Netbeans for debugging

    Maybe activate the logging of the following categories (e.g. via the admin Console under Configuration > Logging > Log Levels) to see if you can spot anything weird:

    • javax.enterprise.system.core.transaction
    • javax.enterprise.resource.jta
    • javax.enterprise.system.container.ejb

    As an alternative (sort of “poor man’s logging”), you could implement SessionSynchronization to get notified about transaction.

    Really weird problem…

    See also

    • Chapter 7 Administering the Logging Service
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just found RowSets for database querying with JDBC. They are stateless and
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I'm trying to create an EJB factory class, which works like this: You have
I've a web service, which is basically a @Stateless EJB annotated with @WebService, and
I am currently running a simple EJB application using a stateless Session Bean. I
i m trying to design a mmo game using python... I have evaluated stackless
Have just started using Google Chrome , and noticed in parts of our site,
I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote
In JPA the Entities are nice annotated Plain Old Java Objects. But I have
Have you ever seen any of there error messages? -- SQL Server 2000 Could

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.