Package com.github.kopylec.rapidjdbc.exception

Examples of com.github.kopylec.rapidjdbc.exception.RapidJDBCException


    private static final Logger LOGGER = LoggerFactory.getLogger(SQLAspect.class);

    @Around("target(repository) && execution(* *(..)) && @annotation(query) && @annotation(update)")
    public Object preventDuplicateSQL(Repository repository, ProceedingJoinPoint joinPoint, Query query, Update update) throws Throwable {
        throw new RapidJDBCException("Multiple SQLs on method " + joinPoint.getSignature().toShortString());
    }
View Full Code Here


            repository.setResultSet(statement.executeQuery());
            return joinPoint.proceed();
        } catch (RapidJDBCException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RapidJDBCException("Error executing query \"" + query.value() + "\" with parameters "
                    + Arrays.toString(joinPoint.getArgs()), ex);
        } finally {
            repository.closeResultSet();
            closeResources(statement);
        }
View Full Code Here

            statement.executeUpdate();
            return result;
        } catch (RapidJDBCException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RapidJDBCException("Error executing update \"" + update.value() + "\" with parameters "
                    + Arrays.toString(joinPoint.getArgs()), ex);
        } finally {
            closeResources(statement);
        }
    }
View Full Code Here

        if (statement != null) {
            LOGGER.trace("Closing prepared statement");
            try {
                statement.close();
            } catch (SQLException ex) {
                throw new RapidJDBCException("Error closing prepared statement", ex);
            }
        }
        if (!isTransactionActive()) {
            closeConnection();
        }
View Full Code Here

    public Repository() throws RapidJDBCException {
        LOGGER.trace("Creating repository of class {}", getClass().getName());

        if (getDataSource() == null) {
            throw new RapidJDBCException("Datasource has not been set");
        }
    }
View Full Code Here

                Field field = entityFieldsByColumns.get(column);
                if (field != null) {
                    field.set(entity, getObject(column));
                }
            } catch (Exception ex) {
                throw new RapidJDBCException("Error setting entity field.\n"
                        + "Entity class: " + entityClass.getName() + "\n"
                        + "Entity field name: " + entityFieldsByColumns.get(column) + "\n"
                        + "Result set column: " + column + "\n"
                        + "Result set column value: " + getObject(column), ex);
            }
View Full Code Here

        LOGGER.trace("Moving result set cursor to the next row");

        try {
            return getResultSet().next();
        } catch (SQLException ex) {
            throw new RapidJDBCException("Error moving cursor forward in result set", ex);
        }
    }
View Full Code Here

     * has been closed; if a database error occurs
     */
    protected final ResultSet getResultSet() throws RapidJDBCException {
        ResultSet rs = resultSet.get();
        if (rs == null) {
            throw new RapidJDBCException("No query has been executed or result set has been closed");
        }
        return rs;
    }
View Full Code Here

            LOGGER.trace("Caching result set columns {}", Arrays.toString(columns));
            resultSetColumns.set(columns);

            return columns;
        } catch (SQLException ex) {
            throw new RapidJDBCException("Error getting column names from result set", ex);
        }
    }
View Full Code Here

            throw new RapidJDBCException("Error getting column names from result set", ex);
        }
    }

    private RapidJDBCException createRapidJDBCExceptionForColumn(String column, SQLException ex) {
        return new RapidJDBCException("Error getting value from column \"" + column + "\"", ex);
    }
View Full Code Here

TOP

Related Classes of com.github.kopylec.rapidjdbc.exception.RapidJDBCException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.