Skip to content

StoredProcedure enhancement to allow parameters to be optional [SPR-3510] #8193

@spring-projects-issues

Description

@spring-projects-issues

toddmcgrath opened SPR-3510 and commented

Extending StoredProcedure is working great.

public SampleStoredProcedure(DataSource dataSource, String sprocName) {
    super(dataSource, sprocName);
    declareParameter(new SqlReturnResultSet("rs", new EventMapper()));
    declareParameter(new SqlParameter("EventTitle", Types.VARCHAR));
    declareParameter(new SqlParameter("EventType", Types.VARCHAR));
    declareParameter(new SqlParameter("StartDate", Types.DATE));
    declareParameter(new SqlParameter("EndDate", Types.DATE));
    declareParameter(new SqlParameter("Location", Types.VARCHAR));
    declareParameter(new SqlParameter("MinPrice", Types.INTEGER));
    declareParameter(new SqlParameter("MaxPrice", Types.INTEGER));
    compile();
}

There are times when I don't want to supply a MinPrice, MaxPrice values and use the defaults I've set in the sproc. But, I can't figure out how to avoid having to set every parameter declared. Know what I mean? Example- if I set 5 of the parameters in the map, I receive an exception about requiring 7 inputs.

Forum Reference: http://forum.springframework.org/showthread.php?t=39086


Issue Links:

12 votes, 8 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: dataIssues in data modules (jdbc, orm, oxm, tx)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions