Code Comments
Programming Forum and web based access to our favorite programming groups.I'm building my first complicated EJB application and I've hit a problem to do with declarative transaction settings. It's a subject that to date I've been able to ignore - now I'm hoping somebody can help me with some general guidance. I'm using the facade pattern where a stateless session bean masks access to underlying CMP entity beans. One of my more important session bean methods is a lengthy process that involves multiple steps, each step will itself call one or more other stateless session beans. Most of the calls to other stateless session beans are to retrieve information, like 'getEntityX', 'findAllEntityY'. Occasionally one of these retrieval calls will fail, (the underlying entity may not exist). This is perculating up as a exception which triggers a transaction roll back error in the main process, which is not what I want. So it seems that I have to declare the transaction settings for each of the retrieval related methods to avoid yes, right? These leads to two general design questions on stateless session beans that act as facades... a). How to handle data not found situations. If I have a session bean method like.... public EmployeeVO findEmployee(String anEmployeeCode); ... what should the method return if the employee does not exist. Should I allow a EJBException to be thrown, or should the session bean method capture the exception and return a null value object result. Both methods are possible, I'm just wondering what is the more popular? b). Declarative transactions for session bean methods Should I by default make all session bean retrieval related methods have a 'not supported' transaction setting?
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.