I have a arraylist which i want to store in database.I am using preparedStatement so how can i pass my arraylist as parameter to store it in database.
my code is:
public void insertEnquiryRecord(StudentEnquiryEntity enquiryEntity) {
// TODO Auto-generated method stub
System.out.println(" hi from vivek..");
ConnectionFactory connectionFactory = null;
connection=connectionFactory.getConnection();
PreparedStatement preparedStatement=null;
ResultSet resultSet=null;
String query1 = "insert into tbl_contmst(CLM_PHNO)values(?)";
try{
preparedStatement=connection.prepareStatement(query1);
preparedStatement.setArray(1, (Array) enquiryEntity.getStudentContactList());
//preparedStatement.setArray(2,(Array) enquiryEntity.getStudentEmailList());
status1 = preparedStatement.executeUpdate();
if(status1 > 0 ){
System.out.println("Data stored Succefully");
}
}catch(Exception sqe){
System.out.println("In insertRecord:"+sqe.getMessage());
}
}