Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue May 22, 2007 · 3 comments
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: data Issues in data modules (jdbc, orm, oxm, tx) status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented May 22, 2007

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

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We should decide on this for 2.5.2 as well, Thomas...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Guram Savinov commented

There is no progress for this feature request since 2007 year, will you work on it in near future?
Check this idea on StackOverflow about how you can implement it: http://stackoverflow.com/questions/22618251/implementing-a-stored-procedure-call-with-optional-parameters-in-spring-3-0

@spring-projects-issues spring-projects-issues added status: ideal-for-contribution An issue that a contributor can help us with in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import labels Jan 11, 2019
@rstoyanchev rstoyanchev added status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process and removed status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues
Copy link
Collaborator Author

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: data Issues in data modules (jdbc, orm, oxm, tx) status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process
Projects
None yet
Development

No branches or pull requests

2 participants