All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xblackcat.sjpu.storage.impl.ABatchedAH Maven / Gradle / Ivy

Go to download

Service for generating DB access logic in simple way via interfaces and annotations

There is a newer version: 2.0
Show newest version
package org.xblackcat.sjpu.storage.impl;

import org.xblackcat.sjpu.storage.IBatchedAH;
import org.xblackcat.sjpu.storage.StorageException;
import org.xblackcat.sjpu.storage.connection.IConnectionFactory;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author xBlackCat Date: 27.07.11
 */
public abstract class ABatchedAH implements IBatchedAH {
    protected final Connection con;

    public ABatchedAH(IConnectionFactory factory) throws StorageException {
        try {
            con = factory.getConnection();
        } catch (SQLException e) {
            throw new StorageException("Failed to borrow connection for Batched Access Helper", e);
        }
    }

    @Override
    public void close() throws StorageException {
        try {
            con.close();
        } catch (SQLException e) {
            throw new StorageException("Failed to close connection", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy