List of usage examples for org.hibernate.exception SQLGrammarException getSQLException
public SQLException getSQLException()
From source file:com.wavemaker.runtime.data.util.DataServiceUtils.java
License:Open Source License
public static RuntimeException unwrap(Throwable th) { th = SystemUtils.getRootException(th); if (InvalidDataAccessResourceUsageException.class.isAssignableFrom(th.getClass())) { InvalidDataAccessResourceUsageException e = (InvalidDataAccessResourceUsageException) th; if (e.getRootCause() != null) { th = e.getRootCause();/*from w w w.j ava 2 s. c o m*/ } } if (SQLGrammarException.class.isAssignableFrom(th.getClass())) { SQLGrammarException s = (SQLGrammarException) th; if (s.getSQLException() != null) { th = s.getSQLException(); } else if (s.getCause() != null) { th = s.getCause(); } } if (th instanceof RuntimeException) { return (RuntimeException) th; } else { return new DataServiceRuntimeException(th); } }
From source file:sernet.gs.ui.rcp.gsimport.ImportTask.java
License:Open Source License
private List<ZielobjektTypeResult> findZielobjekte() throws Exception { List<ZielobjektTypeResult> zielobjekte; try {//from w w w .j a va 2s. co m zielobjekte = getGstoolDao().findZielobjektTypAll(); } catch (SQLGrammarException e) { SQLGrammarException sqlException = e; // wrong db version has columns missing, i.e. "GEF_ID": if (sqlException.getSQLException().getMessage().indexOf("GEF_OK") > -1) { ExceptionUtil.log(sqlException.getSQLException(), "Fehler beim Laden der Zielobjekte. Mglicherweise falsche Datenbankversion des GSTOOL? " + "\nEs wird nur der Import der aktuellen Version (4.7) des GSTOOL untersttzt."); } throw e; } catch (Exception e) { ExceptionUtil.log(e, "Fehler beim Laden der Zielobjekte"); throw e; } return zielobjekte; }