package core.db.repositories;

import core.db.DBConnection;
import core.utils.io.ConfigurationReader;

import java.sql.*;
import java.util.List;

public abstract class Repository<T>
{
    private final Connection connection;

    public Repository() throws SQLException
    {
        this.connection = new DBConnection(ConfigurationReader.get()).getInstance();
    }

    public abstract void save(T tEntity) throws SQLException;

    public abstract T get(int id) throws SQLException;

    public abstract List<T> get() throws SQLException;

    protected Statement getStatement() throws SQLException
    {
        return connection.createStatement();
    }
}
