Example usage for org.hibernate.exception DataException getSQLException

List of usage examples for org.hibernate.exception DataException getSQLException

Introduction

In this page you can find the example usage for org.hibernate.exception DataException getSQLException.

Prototype

public SQLException getSQLException() 

Source Link

Document

Get the underlying SQLException .

Usage

From source file:com.lp.server.util.Facade.java

License:Open Source License

final protected void throwEJBExceptionLPforPersistence(PersistenceException peI) throws EJBExceptionLP {
    EJBExceptionLP en = new EJBExceptionLP(EJBExceptionLP.FEHLER_SQL_EXCEPTION_MIT_INFO,
            "Eine Persistence Exception ist aufgetreten. Infos erhalten Sie in der SQLException");
    if ((Throwable) peI.getCause() instanceof DataException) {
        DataException ed = (DataException) peI.getCause();
        ArrayList<Object> alInfo = new ArrayList<Object>();
        alInfo.add(ed.getSQLException().getMessage().toString());
        alInfo.add(ed.getSQLException().getNextException().getMessage().toString());
        en.setAlInfoForTheClient(alInfo);
    } else {//from w w w  .  j  ava2 s  .c  o m
        ArrayList<Object> alInfo = new ArrayList<Object>();
        alInfo.add(peI.getCause().getMessage());
        alInfo.add(peI.getCause().getStackTrace().toString());
    }
    throw en;
}