I am trying to search for the cust id based on these three constraints. Will it work? Is it ok to use three columns to compare data?
"select cust id from customers where fname = ? and lname = ? and flatno = ?";
This looks like an ordinary parametrized query. I don't see anything ORM related here, so I am moving it to the JDBC forums. You can add as many restrictions as you would like in your where clause. However having a space in cust id looks suspect.