// Path: src/main/java/business/SimpleAffableDbException.java
// public static class SimpleAffableQueryDbException extends SimpleAffableDbException {
//     public SimpleAffableQueryDbException(String message) {
//         super(message);
//     }
// 
//     public SimpleAffableQueryDbException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }
// 
// Path: src/main/java/business/SimpleAffableDbException.java
// public static class SimpleAffableUpdateDbException extends SimpleAffableDbException {
//     public SimpleAffableUpdateDbException(String message) {
//         super(message);
//     }
// 
//     public SimpleAffableUpdateDbException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }
// 
// Path: src/main/java/business/JdbcUtils.java
// public static Connection getConnection()  {
//     if (dataSource == null) {
//         dataSource = getDataSource(JDBC_SIMPLEAFFABLEBEAN);
//     }
// 
//     try {
//         return dataSource.getConnection();
//     } catch (SQLException e) {
//         throw new SimpleAffableConnectionDbException("Encountered a SQL issue getting a connection", e);
//     }
// 
// }


import business.SimpleAffableDbException.SimpleAffableQueryDbException;
import business.SimpleAffableDbException.SimpleAffableUpdateDbException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import static business.JdbcUtils.getConnection;
                throw new SimpleAffableUpdateDbException("Failed to insert an order, affected row count = "
                    + affected);
            }
            long customerOrderId;
            ResultSet rs = statement.getGeneratedKeys();
            if (rs.next()) {
                customerOrderId = rs.getLong(1);
            } else {
                throw new SimpleAffableQueryDbException("Failed to retrieve customerOrderId auto-generated key");
            }

            return customerOrderId;
        } catch (SQLException e) {
            throw new SimpleAffableUpdateDbException("Encountered problem creating a new customer ", e);
        }
    }

    @Override
    public CustomerOrder findByCustomerId(long customerId) {
        return getCustomerOrderBy(FIND_BY_CUSTOMER_ID_SQL, customerId);
    }

    @Override
    public CustomerOrder findByCustomerOrderId(long customerOrderId) {
        return getCustomerOrderBy(FIND_BY_CUSTOMER_ORDER_ID_SQL, customerOrderId);
    }

    @Override
    public Collection<CustomerOrder> findAll() {
        List<CustomerOrder> result = new ArrayList<>(16);
// Path: src/main/java/business/SimpleAffableDbException.java
// public static class SimpleAffableQueryDbException extends SimpleAffableDbException {
//     public SimpleAffableQueryDbException(String message) {
//         super(message);
//     }
// 
//     public SimpleAffableQueryDbException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }
// 
// Path: src/main/java/business/SimpleAffableDbException.java
// public static class SimpleAffableUpdateDbException extends SimpleAffableDbException {
//     public SimpleAffableUpdateDbException(String message) {
//         super(message);
//     }
// 
//     public SimpleAffableUpdateDbException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }
// 
// Path: src/main/java/business/JdbcUtils.java
// public static Connection getConnection()  {
//     if (dataSource == null) {
//         dataSource = getDataSource(JDBC_SIMPLEAFFABLEBEAN);
//     }
// 
//     try {
//         return dataSource.getConnection();
//     } catch (SQLException e) {
//         throw new SimpleAffableConnectionDbException("Encountered a SQL issue getting a connection", e);
//     }
// 
// }


// Path: src/main/java/business/order/CustomerOrderDaoJdbc.java
import business.SimpleAffableDbException.SimpleAffableQueryDbException;
import business.SimpleAffableDbException.SimpleAffableUpdateDbException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import static business.JdbcUtils.getConnection;

                throw new SimpleAffableUpdateDbException("Failed to insert an order, affected row count = "
                    + affected);
            }
            long customerOrderId;
            ResultSet rs = statement.getGeneratedKeys();
            if (rs.next()) {
                customerOrderId = rs.getLong(1);
            } else {
                throw new SimpleAffableQueryDbException("Failed to retrieve customerOrderId auto-generated key");
            }

            return customerOrderId;
        } catch (SQLException e) {
            throw new SimpleAffableUpdateDbException("Encountered problem creating a new customer ", e);
        }
    }

    @Override
    public CustomerOrder findByCustomerId(long customerId) {
        return getCustomerOrderBy(FIND_BY_CUSTOMER_ID_SQL, customerId);
    }

    @Override
    public CustomerOrder findByCustomerOrderId(long customerOrderId) {
        return getCustomerOrderBy(FIND_BY_CUSTOMER_ORDER_ID_SQL, customerOrderId);
    }

    @Override
    public Collection<CustomerOrder> findAll() {
        List<CustomerOrder> result = new ArrayList<>(16);
        try (Connection connection = getConnection();