This ProductDAO class returns with a list of products for the user, but the compiler in Netbeans shows that "Missing return statement." Any advance?
public List<Product> doSelectAvailableProducts( String userid){
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
List<Product> cl = new ArrayList<Product>();
try{
con = datasource.getConnection();
}
catch( SQLException e){
e.printStackTrace();
}
try{
stmt = con.createStatement();
String sql = "select * from Product where id not in " +"(select cid from registration where uid ='" + userid + "')";
rs = stmt.executeQuery(sql);
while( rs.next() ){
Product product = new Product();
product.setId(rs.getInt("id"));
product.setName(rs.getString("name"));
product.setDescription( rs.getString("description"));
product.setPrice( Double.parseDouble(rs.getString("price"))); cl.add(product); }
return cl;
}
catch( SQLException e ){
e.printStackTrace();
}
finally {
if(stmt != null) {
try { stmt.close();}
catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close();}
catch (Exception e) { e.printStackTrace(); }
}} }