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 163233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:31:53+00:00 2026-05-11T11:31:53+00:00

I have an EJB3 application which consists of some EJB’s for accessing a DB,

  • 0

I have an EJB3 application which consists of some EJB’s for accessing a DB, and exposed via a Session Bean as a web service.

Now there are two things I need to find out:

1) Is there any way I can stop SQL exceptions from causing the web service from throwing a SOAP Fault? The transactions are handled by the container, and currently sql exceptions cause a RollBackException to be thrown, and consequently the transaction to be rolled back (desired behaviour) and the web service to throw a fault (not desired).

2) I wish to extend the webservice to be able to take in a list of entities, and the session bean to persist each. However, I want each entity to be executed in its own transaction, so that if one fails the others are not affected (and again the web service should not fault).

For (1) I have tried to catch the RollBackException, but I assume this is thrown somewhere on another thread, as the catch block is never reached. I assume for (2) I will need to look into User Transactions, but firstly would prefer the container to manage this, and secondly do not know how to force the use of user transactions.

Thanks.

  • 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. 2026-05-11T11:31:54+00:00Added an answer on May 11, 2026 at 11:31 am

    no, you can do all this with container managed transactions (and this is definitely preferable, as managing transactions is a pain).

    the gist of the solution is to create a second EJB with a local interface only and the transaction semantics you desire. then your ‘public’ ejb, which the web-service is calling directly, calls into this second ejb via its local interface to do the actual work.

    something along the lines of:

    public class MyPublicEjb {   @EJB   private MyPrivateImpl impl;    public void doSomething() {     try {       impl.doSomething();     } catch(TXRolledBack) {       // handle rollback ...     }   } } 

    I know this looks sort of ugly, but trust me, this is far preferable to directly manipulating transactions.

    • 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-3.1 session bean containing an asynchronous method that does some
I have a JavaEE6 application, consisting of Web stuff and EJBs and which is
First some background information: We have three environments for our EJB3 application: test, development
I'm developing java enterprise web application using EJB 3.1 and I wonder which technology
I have a RESTful service which injects an EJB(3.0) using the @EJB annotation. This
I have an application which processes IQ stanzas via smack (eventbased java library). We
I have a simple j2ee application: foo.ear - foo.war - foo.jar (ejb3 jar) I
Have a n-tire web application and search often times out after 30 secs. How
I have a JavaEE6-application running on Glassfish v3.0.1 with EJB 3.1 (app is packaged
I have a Java (6) application which uses Hibernate (V3.3.2) to read data from

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.