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

org.solovyev.common.db.SingleProduceManager Maven / Gradle / Ivy

The newest version!
package org.solovyev.common.db;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * User: serso
 * Date: Oct 15, 2009
 * Time: 12:13:28 AM
 */
public class SingleProduceManager extends AbstractProduceManager implements SQLCommand{

    public SingleProduceManager(SQLProducer producer) {
        super(producer);
    }

    public T execute(Connection dbConnection) throws SQLException {
        Statement s = dbConnection.createStatement();
        ResultSet rs;
        T result = null;
        rs = s.executeQuery(producer.getQuery().getStringQuery());
        if (rs != null && rs.next()) {
            result = producer.createInstance(rs, dbConnection);
        }
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy