return items;
}
public Collection<Item> getItemsForCategory(Category category) {
UserDAO userDAO = null;
try {
userDAO = new JDBCUserDAO();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Collection<Item> items = new ArrayList<Item>();
StringBuffer sqlBuffer = new StringBuffer();
sqlBuffer.append("SELECT * FROM items WHERE CATEGORY=");
sqlBuffer.append(category.getId());
ResultSet resultSet = null;
try {
resultSet = excecuteScrollableQuery(sqlBuffer.toString());
while (resultSet.next()) {
Item item = new Item();
item.setId(new Integer(resultSet.getInt("ID")));
item.setName(resultSet.getString("NAME"));
try {
item.setSeller(userDAO.loadUser(new Integer(resultSet.getInt("SELLER"))));
} catch (UserNotFoundException e) {
e.printStackTrace();
}
item.setCategory(category);
item.setBuyNow(resultSet.getFloat("BUY_NOW"));