Spring Framework BadSqlGrammarException - 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 BadSqlGrammarException class.

This code example shows how to use the following methods:
			} 
			else if (ex instanceof SQLInvalidAuthorizationSpecException) { 
				return new PermissionDeniedDataAccessException(buildMessage(task, sql, ex), ex); 
			} 
			else if (ex instanceof SQLSyntaxErrorException) { 
				return new BadSqlGrammarException(task, sql, ex); 
			} 
			else if (ex instanceof SQLFeatureNotSupportedException) { 
				return new InvalidDataAccessApiUsageException(buildMessage(task, sql, ex), ex); 
			} 
		} 
		else if (ex instanceof SQLRecoverableException) { 
			return new RecoverableDataAccessException(buildMessage(task, sql, ex), ex); 
		} 
 
		// Fallback to Spring's own SQL state translation... 
		return null; 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
			String classCode = sqlState.substring(0, 2); 
			if (logger.isDebugEnabled()) { 
				logger.debug("Extracted SQL state class '" + classCode + "' from value '" + sqlState + "'"); 
			} 
			if (BAD_SQL_GRAMMAR_CODES.contains(classCode)) { 
				return new BadSqlGrammarException(task, sql, ex); 
			} 
			else if (DATA_INTEGRITY_VIOLATION_CODES.contains(classCode)) { 
				return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex); 
			} 
			else if (DATA_ACCESS_RESOURCE_FAILURE_CODES.contains(classCode)) { 
				return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex); 
			} 
			else if (TRANSIENT_DATA_ACCESS_RESOURCE_CODES.contains(classCode)) { 
				return new TransientDataAccessResourceException(buildMessage(task, sql, ex), ex); 
			} 
			else if (CONCURRENCY_FAILURE_CODES.contains(classCode)) { 
				return new ConcurrencyFailureException(buildMessage(task, sql, ex), ex); 
			} 
		} 
5
CodeRank
This code example shows how to use the following methods:
                    .getDAOMetaData().getConstants()); 
            runtime.setArgs(context.getParams()); 
            runtime.setSQL(context.flushOut()); 
        } catch (Exception e) { 
            String daoInfo = runtime.getMetaData().toString(); 
            throw new BadSqlGrammarException(daoInfo, runtime.getSQL(), 
                    new SQLSyntaxErrorException(daoInfo + " @SQL('" + runtime.getSQL() + "')", e)); 
        } 
 
    } 
 
    public static void main(String[] args) throws Exception { 
        // 转换语句中的表达式 
        String sql = "insert ignore into table_name " 
                + "(`id`,`uid`,`favable_id`,`addtime`,`ranking`) "// 
                + "values (:1,:2,now(),0)"; 
        ExqlPattern pattern = ExqlPatternImpl.compile(sql); 
        ExqlContextImpl context = new ExqlContextImpl(sql.length() + 32); 
 
        Map<String, Object> parametersAsMap = new HashMap<String, Object>(); 
4
CodeRank