Spring Framework SQLExceptionTranslator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework SQLExceptionTranslator class.

This code example shows how to use the following methods:translate
	protected DataAccessException convertJdbcAccessException(SQLException ex) { 
		SQLExceptionTranslator translator = getJdbcExceptionTranslator(); 
		if (translator == null) { 
			translator = getDefaultJdbcExceptionTranslator(); 
		} 
		return translator.translate("Hibernate-related JDBC operation", null, ex); 
	} 
 
	/** 
	 * Obtain a default SQLExceptionTranslator, lazily creating it if necessary. 
	 * <p>Creates a default 
	 * {@link org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator} 
	 * for the SessionFactory's underlying DataSource. 
	 */ 
	protected synchronized SQLExceptionTranslator getDefaultJdbcExceptionTranslator() { 
		if (this.defaultJdbcExceptionTranslator == null) { 
			this.defaultJdbcExceptionTranslator = SessionFactoryUtils.newJdbcExceptionTranslator(getSessionFactory()); 
		} 
		return this.defaultJdbcExceptionTranslator; 
	} 
4
CodeRank
See Code Examples for Spring Framework SQLExceptionTranslator Methods: