Java Code Examples for org.springframework.jdbc.core.SqlParameter

Following code examples demonstrate how to use org.springframework.jdbc.core.SqlParameterfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.jdbc.core.SqlParameterand various code implementation of this class.

    public TodoDeleteQuery(DataSource ds) {
        super(ds, "delete from todos where todo_id = ?");
        super.declareParameter(new SqlParameter("id", Types.BIGINT));
        compile();
    } 


    public BaseQuery(DataSource ds, String sql, SqlParameter... parameters) {
        super(ds, sql);

        for (SqlParameter sp : parameters) {
            declareParameter(sp);
        }

        setFetchSize(1000);
        compile();
    } 

    public StoredFucntionFirstNameById(DataSource ds) {
        super(ds, SQL);
        declareParameter(new SqlParameter(Types.INTEGER));
        compile();
    } 

    public AccountDelete(DataSource dataSource) {
        super(dataSource, "delete account where id = ?");
        setParameters(new SqlParameter[]{new SqlParameter(Types.BIGINT)});
        compile();
    } 

    public StoredFunctionFirstNameById(DataSource ds) {
        super(ds, SQL);
        declareParameter(new SqlParameter(Types.INTEGER));
        compile();
    } 

    public DeleteProductSql(DataSource dataSource) {
        setDataSource(dataSource);
        setSql("DELETE FROM VSB.PRODUCT WHERE ID=?");
        declareParameter(new SqlParameter("ID", Types.INTEGER));
        compile();
    } 

Advertisement
Javadoc
Object to represent a SQL parameter definition.

Parameters may be anonymous, in which cas

e "name" is null. However, all parameters must define a SQL type according to java.sql.Types. @author Rod Johnson @author Thomas Risberg @author Juergen Hoeller @see java.sql.Types

Read More
Advertisement