org.skife.jdbi.v2.Handle Maven / Gradle / Ivy
/*
* Copyright (C) 2004 - 2014 Brian McCallister
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.skife.jdbi.v2;
import org.skife.jdbi.v2.exceptions.TransactionFailedException;
import org.skife.jdbi.v2.tweak.ArgumentFactory;
import org.skife.jdbi.v2.tweak.ContainerFactory;
import org.skife.jdbi.v2.tweak.ResultSetMapper;
import org.skife.jdbi.v2.tweak.SQLLog;
import org.skife.jdbi.v2.tweak.StatementBuilder;
import org.skife.jdbi.v2.tweak.StatementLocator;
import org.skife.jdbi.v2.tweak.StatementRewriter;
import java.io.Closeable;
import java.sql.Connection;
import java.util.List;
import java.util.Map;
/**
* This represents a connection to the database system. It ususally is a wrapper around
* a JDBC Connection object.
*/
public interface Handle extends Closeable
{
/**
* Get the JDBC Connection this Handle uses
* @return the JDBC Connection this Handle uses
*/
Connection getConnection();
@Override
/**
* @throws org.skife.jdbi.v2.exceptions.UnableToCloseResourceException if any
* resources throw exception while closing
*/
void close();
/**
* Define a statement attribute which will be applied to all {@link StatementContext}
* instances for statements created from this handle
*
* @param key Attribute name
* @param value Attribute value
*/
void define(String key, Object value);
/**
* Start a transaction
*/
Handle begin();
/**
* Commit a transaction
*/
Handle commit();
/**
* Rollback a transaction
*/
Handle rollback();
/**
* Rollback a transaction to a named checkpoint
* @param checkpointName the name of the checkpoint, previously declared with {@link Handle#checkpoint}
*/
Handle rollback(String checkpointName);
/**
* Is the handle in a transaction? It defers to the underlying {@link org.skife.jdbi.v2.tweak.TransactionHandler}
*/
boolean isInTransaction();
/**
* Return a default Query instance which can be executed later, as long as this handle remains open.
* @param sql the select sql
*/
Query
© 2015 - 2025 Weber Informatics LLC | Privacy Policy