List stocks = new ArrayList();
try {
String query = "select A.quantity,A.stockid,B.name,B.price from TradingAccount A,stocks B where A.userid = ? and A.stockid = B.id";
PreparedStatement pStmt = con.prepareStatement(query);
pStmt.setString(1, userId);
Stock stock = null;
ResultSet rs = pStmt.executeQuery();
while (rs.next()) {
stock = new Stock(rs.getString(2), rs.getString(3), rs
.getFloat(4), rs.getInt(1));
stocks.add(stock);
}
pStmt.close();
} catch (SQLException ex) {