import java.sql.Types;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.SqlUpdate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
class Main {
public static void main(String args[]) throws Exception {
ApplicationContext ac = new ClassPathXmlApplicationContext("context.xml", Main.class);
DataSource dataSource = (DataSource) ac.getBean("dataSource");
//DataSource mysqlDataSource = (DataSource) ac.getBean("mysqlDataSource");
DeleteWhereIdGreater deleteWhereIdGreater = new DeleteWhereIdGreater(dataSource);
deleteWhereIdGreater.update(1L);
}
}
class DeleteWhereIdGreater extends SqlUpdate {
private static final String SQL = "delete from customer where id > ?";
DeleteWhereIdGreater(DataSource dataSource) {
super(dataSource, SQL);
declareParameter(new SqlParameter(Types.INTEGER));
}
}
|