users@glassfish.java.net

best way to handling ejb exceptions

From: mSephiroth <moi87g_2_at_yahoo.com>
Date: Tue, 6 Apr 2010 18:11:37 -0700 (PDT)

Hi, I dont know if this is the correct forum to post this but i have a
situation.

Im working on Glassfish v3, jee 6, jsf 2 and netbeans 6.8.

I have a package with session beans that access to the database (facades),
and a package with session beans that manage the bussines rules(bussines).
The situation is when i have a error in the facades beans like duplicated
key on the Database, the error is catch by a DataExcepcion create by me, but
the excepcion jump until the managedBeans on the web tier and shows and
EJBexcepcions, the DataExcepcion dont work, can you tell me a way to handle
this exceptions??

-------- The facade bean:

@Stateless
public class SisUsuarioFacade {

    @PersistenceContext(unitName = "ELearningIATIC_EE-ejbPU")
    private EntityManager em;

    public void create(SisUsuario sisUsuario) throws
DataAccessLayerException {
        try {
            em.persist(sisUsuario);
        } catch (Exception e) {
            throw new DataAccessLayerException("Clase: " +
SisUsuarioFacade.class.getName() + " Método: create(SisUsuario
sisUsuario)");
        }

    }
}

---------- the Bussines bean
@Stateless
@LocalBean
public class UsuarioServicio {
@EJB
    private SisUsuarioFacade sisUsuarioFacade;


    public void crearUsuario(SisUsuario usuario, SisRol rolUsuario) throws
ServiceLayerException, DataAccessLayerException {
       
        sisUsuarioFacade.create(usuario);
    }
.....
}



thanks
-- 
View this message in context: http://old.nabble.com/best-way-to-handling-ejb-exceptions-tp28159453p28159453.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.