rs.close();
} catch (Exception e) {
logger.debug("", e);
}
} catch (SQLException e) {
throw new DAOException("Exception is thrown when selecting the accountID from order entries where order ID :" + order.getOrderID(), e);
} finally {
if (getAccountIdStat != null) {
try {
getAccountIdStat.close();
} catch (Exception e) {
logger.debug("", e);
}
}
}
if (accountId != -1) {
int holdingId = -1;
PreparedStatement insertHoldingStat = null;
try {
insertHoldingStat = sqlConnection.prepareStatement(SQL_INSERT_HOLDING);
insertHoldingStat.setBigDecimal(1, order.getPrice());
// C# - insertHolding.setFloat(1, (float) order.getQuantity());
insertHoldingStat.setDouble(2, order.getQuantity());
Calendar openDate = (order.getOpenDate() != null) ? order.getOpenDate() : Calendar.getInstance();
insertHoldingStat.setDate(3, StockTraderUtility.convertToSqlDate(openDate));
insertHoldingStat.setInt(4, order.getAccountId());
insertHoldingStat.setString(5, order.getSymbol());
ResultSet rs = insertHoldingStat.executeQuery();
if (rs.next()) {
holdingId = rs.getInt(1);
}
try {
rs.close();
} catch (Exception e) {
logger.debug("", e);
}
return holdingId;
} catch (SQLException e) {
throw new DAOException("An exception is thrown during an insertion of a holding entry", e);
} finally {
if (insertHoldingStat != null) {
try {
insertHoldingStat.close();