I use Spring-JDBC to insert the list of facebook friends for a user in my MySQL database.
I have a final Long that contains the user uid and a List that contains the list of his friends.
my query is:
final String sqlInsert="insert into fb_user_friends(fb_uid,friend_uid) values(?,?)";
I create batch parameters using SqlParameterSourceUtils
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(friendsList.toArray());
and I execute the insert using:
int[] insertCounts = this._jdbcTemplate.batchUpdate(sqlInsert,batch);
the problem here that the list contains only the 2nd parameter that's required by the query.
do I have to modify the friendsList to add to it another column or is there another way?
thanks!
Originally asked by: ufk on Stack Overflow


Answers