/** * Queries the items for a given order. * * @param order the order to be filled with it's items * @throws SQLException if there is a problem with the underlying JDBC connection */ private void populateOrderItems(final Order order) throws SQLException { synchronized (this.connection) { try (PreparedStatement statement = this.connection.prepareStatement(SQL_SELECT_PURCHASE_ITEMS)) { statement.setLong(1, order.getIdentity()); try (ResultSet resultSet = statement.executeQuery()) { while (resultSet.next()) { final OrderItem item = new OrderItem(); item.setIdentity(resultSet.getLong("identity")); item.setArticleIdentity(resultSet.getLong("articleIdentity")); item.setArticleGrossPrice(resultSet.getLong("articlePrice")); item.setCount(resultSet.getInt("count")); order.getItems().add(item); } } } } }