Package org.skife.jdbi.v2

Examples of org.skife.jdbi.v2.VoidTransactionCallback


        return new File(shardPath, format("%s.%s.column", columnId, encoding.getName()));
    }

    private void commitShardColumns(final ColumnFileHandle columnFileHandle)
    {
        dbi.inTransaction(new VoidTransactionCallback()
        {
            @Override
            protected void execute(Handle handle, TransactionStatus status)
                    throws Exception
            {
View Full Code Here


        ResultSet rs;
        try {
            rs = this.stmt.getReturnResultSet();
        }
        catch (SQLException e) {
            throw new ResultSetException("Unable to retrieve return result set", e);
        }

        this.results = new ArrayList<ResultType>();
        try {
            int i = 0;
            while (rs.next()) {
                results.add(mapper.map(i++, rs, context));
            }
        }
        catch (SQLException e) {
            throw new ResultSetException("Unable to retrieve results from returned result set", e);
        }
    }
View Full Code Here

        try {
            hasNext = results.next();
        }
        catch (SQLException e) {
            throw new ResultSetException("Unable to advance result set", e);
        }
        if (!hasNext) {
            try {
                results.close();
            }
            catch (SQLException e) {
                throw new ResultSetException("Unable to close result set after iterating through to the end", e);
            }
        }
        alreadyAdvanced = true;
        return hasNext;
    }
View Full Code Here

                if (!results.next()) {
                    throw new IllegalStateException("No element to advance to");
                }
            }
            catch (SQLException e) {
                throw new ResultSetException("Unable to advance result set", e);
            }
        }
        alreadyAdvanced = false;
        try {
            return mapper.map(count++, results, context);
        }
        catch (SQLException e) {
            throw new ResultSetException("Error thrown mapping result set into return type", e);
        }
    }
View Full Code Here

        {
            m = r.getMetaData();
        }
        catch (SQLException e)
        {
            throw new ResultSetException("Unable to obtain metadata from result set", e);
        }

        try
        {
            for (int i = 0; i < m.getColumnCount(); i ++)
            {
                String key = m.getColumnName(i);
                String alias = m.getColumnLabel(i);
                Object value = r.getObject(i);
                row.put(alias != null ? alias : key, value);
            }
        }
        catch (SQLException e)
        {
            throw new ResultSetException("Unable to access specific metadata from " +
                                         "result set metadata", e);
        }
        return row;
    }
View Full Code Here

            this.rollback();
            throw e;
        }
        catch (Exception e) {
            this.rollback();
            throw new TransactionFailedException("Transaction failed do to exception being thrown " +
                                                 "from within the callback. See cause " +
                                                 "for the original exception.", e);
        }
        if (failed[0]) {
            this.rollback();
            throw new TransactionFailedException("Transaction failed due to transaction status being set " +
                                                 "to rollback only.");
        }
        else {
            return returnValue;
        }
View Full Code Here

        try {
            connection.close();
            log.logReleaseHandle(this);
        }
        catch (SQLException e) {
            throw new UnableToCloseResourceException("Unable to close Connection", e);
        }
    }
View Full Code Here

            }
            reader.close();
        }
        catch (IOException e)
        {
            throw new UnableToCreateStatementException(e.getMessage(), e);
        }
        return buffer.toString();
    }
View Full Code Here

        {
            this.info = Introspector.getBeanInfo(bean.getClass());
        }
        catch (IntrospectionException e)
        {
            throw new UnableToCreateStatementException("Failed to introspect object which is supposed ot be used to" +
                                                       " set named args for a statement via JavaBean properties", e);
        }

    }
View Full Code Here

                {
                    return new ObjectArgument(descriptor.getReadMethod().invoke(bean));
                }
                catch (IllegalAccessException e)
                {
                    throw new UnableToCreateStatementException(String.format("Access excpetion invoking getter for " +
                                                                             "bean property [%s] on [%s]",
                                                                             name, bean), e);
                }
                catch (InvocationTargetException e)
                {
                    throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " +
                                                                             "getter for bean property [%s] on [%s]",
                                                                             name, bean), e);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.skife.jdbi.v2.VoidTransactionCallback

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.