Dynamically Insert Variables into DB Table using PreparedStatement
- by gran_profaci
I was working with PreparedStatement today and noticed that it used setString() setTimestamp() etc. to insert variables into the DB.
I basically have 20 tables each with at least 15 columns and it would not be feasible for me to manuallt write down all the setters. Considering that I have an ArrayList "Vals" which contains all the variables to be inputted in String format (obtained by getString() using PreparedStatement itself), is there any way I can do an insert without using expressly using the Setters? That would save me a lot of time.