Good old EJBException question...

I've trawled through this forum for a good explanation of EJBException versus RemoteException. I've not found anything I consider particularly intuitive. In fact, I've been amazed by some of the confusion that seems to exist about this, with some people responding with answers that are simply wrong.
So, for my own enlightenment and hopefully the other people who've asked this question - could someone please give an explanation of when to throw an EJBException, when to throw a RemoteException (if ever) and when to throw another type of Exception?
I'm also interested in what the client is guaranteed to receive in each of these cases and what effect this has on the bean that has thrown it.
And just to keep things good and simple could they try to do it without mentioning "the specification"? I have read the specification but would like to know how it manifests itself in the real world and what is considered "good practice" in this matter.
Many thanks in advance.

hey kevin, you causing problems again!
you've probably seen this article by now on EJBExcepitons at the serverside.com but here is the link anyway:
http://www-106.ibm.com/developerworks/java/library/j-ejbexcept.html
EJB exceptions are mine field but there are a couple solid guidelines that i follow when designing my beans with exceptions:
1. Application Exceptions ( not descendants of RuntimeException or RemoteException ) are passed back to the client as is to give them the chance to take the appropriate recovery action. So before you leave your business method, you'd better make damned sure that you don't compromise data integrity. If you can't guarantee data integrity do the EJBContext.setRollbackOnly() thing. Which means that as a client you should get into the habit of doing UserTransaction.getStatus().
2. Runtime Exceptions ( ignore EJBException for now ). I don't catch them but i'm not expecting them, and i don't know what to do with them. Thankfully, the container does (which is to log the exception, throw back RemoteExceptions to remote clients and EJBException to local clients, rollback the transaction and then take the bean instance out of service). So i delegate the handling of runtime exceptions to the container. i do not catch Throwable in my bean methods.
3. System Exception ( EJBExceptions ). Where possible using EJB standard exceptions such as CreateException and FinderException. If my bean throws a checked exception, i need to gauge whether or not i can recover from it. I can't, i wrap it in an EJBException and throw it out for the container to do its stuff ( log, raise client exception, rollback and die ). Otherwise, i perform clean up in my bean to return my resources to the state they were before i started executing this method and raise the checked exception.
In the article above the author's penultimate section talks about when to use an application exception over a system exception. Its always the client the determines which way your go. For example, what should you do during a create ejb you need to look up some data in the database and an SQLException is raised. Within the create method it is an application exception for sure because the system is not compromised, however, from the clients point of view, the bean cannot be created because key data was missing. Hence, the method should wrap the SQLException in an EJBException and throw it out to make sure the bean is not created. (If fact, the method retry something else and if nothing else works raise the EJBException).
cleve

Similar Messages

  • ES Repository vs. our good old Integration repository?

    As mentioned in my blog, I am posting a set of questions on ESR in this forum as an interesting way of sharing relevant information with the community. In the true spirit of forums, the one who answers the question is rewarded!
    What are the differences between the ES Repository and our good old Integration Repository?

    Hi,
    ok let me give it a try - I can list down some of the new features of ESR over the old IR :
    1) ESR has the ARIS for SAP Netweaver integrated where process component models can be developed
    2) We have Business Objects in ESR (which were not present in IR). These BO has CRUD operations called the core services combining which the compound services are modeled
    3) There is no more Message Interfaces but Service Interfaces only
    4) Unlike the Enterprise Services developed using the IR (NW 7.0) now Enterprise Service interfaces developed in ESR can have multiple operations.
    5) ESR has a UDDI registry provided by SAP where the Enterprise Services developed in ESR can be directly published.
    Thanks,
    Dipankar

  • I am having trouble answering my old security questions for my itunes account and it is creating a problem because I am not able to purchase apps/songs on my new IPAD. What phone number/email adress should I call to get a quick response to my issue?

    I have recently bought an IPAD 2 for my girlfriend and have encountered a problem with purchasing apps through my itunes account. It is requesting that I not only enter my pasword (which I know) but answer my old account questions, which I have forgotten the answers to. It had since locked me out of changing my questions for eight hours. Is there any number I can call to prove that I am the real owner of my itunes account so my girlfriend will be able to use her ipad to purchase new apps without having to go through the trouble of using one of my other apple devices? Random information: I believe my questions were set back in 2007 when I purchased my first ipod nano, since then I have used this same itunes account for my own ipod touch and ipad 2 and my girlfriends iphone 1st generation. I have never run into a problem regarding my questions before on any of these devices

    http://www.apple.com/support/itunes/contact/

  • I signed into my Apple ID on a new phone and I already had it on my iPod. When I signed into the new phone it won't let me buy anything unless I know my old security questions but I don't know the answers to them. How can I get past those or change them?

    I signed into my Apple ID on a new phone and I already had it on my iPod. When I signed into the new phone it won't let me buy anything unless I know my old security questions but I don't know the answers to them. How can I get past those or change them?

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • Reports 10g vs the good old days

    Having been running reports from forms since the good/old client-server days, reports 10g is both a blessing and a curse. While it's certainly nice not to have to install software on each and every client box, since reports are now kept in cache on the middle tier app server until the cache hits its max size limitation, other users can issue a ?getjobid=nnn and just fish around for reports that others have run. In the good old days, a user would run a report locally on their desktop, that could be printed, and no one else could look at it. Does anyone out there know how or if a report run on the app server can be run just for the user who has access to it, and not be available to anyone who is "fishing" with getjobid? I'd really like to specify, if I could that the report be cached for just a few minutes. Essentially most of our users generate reports only needed by them and they are very dynamic in nature, so storing them isn't really necessary. Any ideas out there?
    Thanks in advance.
    Phil McDermott
    University of Illinois

    Use the EXPIRATION parameter to specify how long a report is kept in the cache. See the online help.

  • Good Old Reliable BT-Poles

    A lot has to to be said for the good old BT-Poles. The one outside my house has stood there for longer than I care to remember.
    Through gales, severe snow storms, thunder-storms, torrential rain, heat-waves and the frequent visit from the local dogs
    I wish the same could be said about my back yard brick wall.
    Today both were hit by (not too hard) by a car which was trying to do a 3-point-turn.
    My wall collapsed - albeit in one piece.
    And the BT-Pole? It stood there, not even a tremor from it.
    They built them good in them days.
    . . . it must be remembered that the sea is a great breeder of friendship. Two men who have known each other for twenty years find that twenty days at sea bring them nearer than ever they were before, or else estrange them.

    one of my local ones has survived a hit from a truck it bend the traffic light pole but only a small dent in the pole

  • Good old days PS icon

    For anybody nostalgic for the good old PS eye, here's the classic eye icon circa PS 5, ready to be used (on Windows machines anyway, not sure about Mac). It's actually not that easy to find. I've had it hanging around for years.
    www.wildnorthwest.org/photoshop.ico

    Interesting, but this is the Lightroom Forum, not Photoshop, per se! Not exactly the correct forum for this!
    Don

  • Good old IE 6!!!

    Good old IE 6, still a solid 25% of people using it and still
    doing my head in!
    Could you take a look here in IE6:
    Website Here
    Problem is #sidebar1 is not floating correctly and pushing my
    #mainContent down the page.
    Can you help.
    Thanks,
    Richard

    Use a conditional comment to reduce the width of #mainContent
    by 3-5px...
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "RICH POW" <[email protected]> wrote in
    message
    news:gggtdn$5cq$[email protected]..
    > Good old IE 6, still a solid 25% of people using it and
    still doing my
    > head in!
    >
    > Could you take a look here in IE6:
    >
    >
    http://wilcox.shared.rylhost.net
    >
    > Problem is #sidebar1 is not floating correctly and
    pushing my #mainContent
    > down the page.
    >
    > Can you help.
    >
    > Thanks,
    > Richard
    >
    >

  • I can't get rid of "my web search" while powered by google, it sux! I want good old google or google chrome

    When firefox opens up, the search window on the right has My Web Search within. often, when I want GOOGLE, I get this "My Web Search", 'powered by google. My searches are terrible...MyWebSearch gives me a lot of worthless [obviously] paid-for search results.
    I followed their instructions and deleted it by 'removing the program' in my control panel, etc., through the start menu. yet this lingers, and i can't find it anywhere in my computer memory to try to reemove it again.
    It sux!
    I want to use good old google!!
    Help me get rid of it!!

    hello hmsa76l79, please also go to firefox > addons > extensions & remove any suspicious entries (toolbars, things that you have not installed intentionally, etc).
    [[Remove a toolbar that has taken over your Firefox search or home page]]
    afterwards install the search reset addon - it will revert the most common customziations those adware programs do in firefox back to the default: https://addons.mozilla.org/firefox/addon/searchreset/

  • I would like to use SolidWorks on my good old MacBook Pro

    Hello,
    I would like to start using SolidWorks on my good old macbook pro. I understand I need to put a PC platform on my mac & use a bootcamp or parallels... But I cannot understand if after doing all that my macbook will be able to carry this software. here are my specs:
    MacBook Pro 17-inch Core 2 Duo, from 2006
    Processor: 2.33 GHz Intel Core 2 Duo
    Memory: 3GB 667 MHz DDR2 SDRAM
    Graphics: ATI Radeon X1600 256 MB
    Software: MacOS X Lion 10.7.3 (11D50)
    Can anyone please help or give me some advise?
    Anyone with experience with Solidworks & macs?
    Thanks
    Orit

    I had volume and volume control from my computer speakers through the keyboard,  but I didn't have volume from my headphones until I un muted them under sound

  • Hi there...i forgot my security questions how can i reset it because everytime i try to reset it it always ask me my old security questions...

    hi there...i forgot my security questions how can i reset it because everytime i try to reset it it always ask me my old security questions...

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (101644)

  • Good day my question is , does anyone of you experiencing when making a call with facetime the phone shuts off and restart

    good day my question is , does anyone of you experiencing when making a call with facetime the phone shuts off and restart

    See this veeeeeeeeeery long thread.
    https://discussions.apple.com/thread/3404857
    It's an issue with hundreds of phones.  Some claim it's software related, some hardware, some say it's a mixture of both.
    Some people have had temporary success with quitting the Phone.app / restoring as a new phone / restoring from an iCloud backup / disabling Siri / toggling speakerphone on & off...
    Unfortunately all of the above only been temporary, with the problem recurring again after a few calls, or a few days etc.
    So far the only solution that seems permanent has been to replace the phone.  But even so, it's the luck of the draw to recieve a functional phone, and not another faulty one.
    I'm completely annoyed as there is no Apple Store near me...... and Apple haven't even acknowledged the issue, despite the above thread being 34 pages long, as of writing.

  • Hello, good day, my question is, buy Logic Express, but then put logic pro 9 in the same price, I can not buy logic studio, and let me know if I buy now logic pro, I can buy separately after jams that bring logic studio. thanks

    Hello, good day, my question is, buy Logic Express, but then put logic pro 9 in the same price, I can not buy logic studio, and let me know if I buy now logic pro, I can buy separately after jams that bring logic studio. thanks

    José, if you buy and download Logic Pro in App Store now, the best option would be to buy an upgrade to Logic Studio. I don't think Jam Packs are available any more in Apple Store, besides it will be more expensive buying them one by one than upgrading to Studio.
    Español: José, si compras y bajas Logic Pro de App Store ahora, despues la mejor opción será comprar el upgrade a Logic Studio. No creo que estos dias fuera posible comprar Jam Packs de Apple Store, y además comprarlos uno por uno seria más caro que el upgrade a Studio.

  • What useful features am I loosing keeping the good old IOS 6.13 on iPad 2?

    Guys, I'm quite confused to keep the good old 6.13 IOS for my iPad 2 or upgrade to 8.1?
    What I know;
    IOS 6.13;
    -looks better, faster, maybe gives longer battery life
    IOS 8.1;
    -new features, but what? I heard airdrop not even working on iPad 2.
    My second device is iPhone 6 with IOS 8.1. Are they doing something better together if both of them are on 8.1?

    Thanks for the input.

  • HT201303 I reset my iTunes Security Questions and when I go into the Apple Store to buy a TV Show it is still asking me the old security questions, not the new ones... How do I make iTunes ask me the new security questions?

    I reset my iTunes Security Questions and when I go into the Apple Store to buy a TV Show it is still asking me the old security questions, not the new ones... How do I make iTunes ask me the new security questions?

    Get prepared for some bad news, then contact iTS.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

Maybe you are looking for

  • HOW TO GET MORE SPACE ON MY MAC

    Anybody have an idea how to free space of my mac.i bought new external hard drive and move most of my folder with music films and document in it.after moving i deleted them from my laptop then emtpy the trash,but after doing this,i still dont get fre

  • HP Wifi Mobile Mouse

    My Wifi Mobile Mouse is pairing, but then its not connecting, I can't use it to control my pointer or anything. I've installed the suite that came with the mouse on the disk. Can anyone help me get my mouse working?

  • Vendor Account Balance

    Hi I want to know how to pull out account balance for a vendor as on a particular date Regards Farheen

  • REP-1219 : 'Body' has no size - length or width is zero

    Hi. I am using reports 6i (6.0.8.11.3). There is a report which runs successfully, and suddenly after adding some fields to the layout, it start giving the error :- REP-1219 : 'Body' has no size - length or width is zero I have checked everything in

  • Deleting Records from Referential Tables

    Hi, Can anyone help me in deleting records from tables in a hierarcial manner. For e.g C refers B and B refers A. I need to delete data from all three tables related to a where clause in A.I tried using User_constraints and User_cons_columns views. B