public <T> void insert(String sql, List<T> objlist) {
final List<T> list=objlist;
BatchPreparedStatementSetter setter=new BatchPreparedStatementSetter(){
public int getBatchSize(){
return list.size();
}
public void setValues(PreparedStatement ps,int index) throws SQLException{
T t=list.get(index);
Field fields[]=t.getClass().getDeclaredFields();
try {
for(int i=0;i<fields.length;i++){
PropertyDescriptor prop=new PropertyDescriptor(fields[i].getName(),t.getClass());
Method getmethod=prop.getReadMethod();
if(fields[i].getType().getCanonicalName().equalsIgnoreCase("java.lang.String")){
ps.setString(i+1, String.valueOf(getmethod.invoke(t)));
//System.out.println(ps.getResultSet().getString(i+1));
}
else if(fields[i].getType().getCanonicalName().equalsIgnoreCase("int")){
ps.setInt(i+1, (Integer)getmethod.invoke(t));
//System.out.println(ps.getResultSet().getInt(i+1));
}
else if(fields[i].getType().getCanonicalName().equalsIgnoreCase("long")){
ps.setLong(i+1, (Long) getmethod.invoke(t));
//System.out.println(ps.getResultSet().getLong(i+1));
}
else if(fields[i].getType().getCanonicalName().equalsIgnoreCase("double")){
ps.setDouble(i+1, (Double) getmethod.invoke(t))