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

SimpleJdbcCall does not throw an Exception for a missing stored procedure if the name does not contain "." [SPR-13669] #18244

spring-projects-issues opened this issue Nov 11, 2015 · 1 comment
in: data Issues in data modules (jdbc, orm, oxm, tx) type: bug A general bug


Copy link

spring-projects-issues commented Nov 11, 2015

Attila Király opened SPR-13669 and commented

Try these with an empty (for example in memory, derby) database:

new SimpleJdbcCall(jdbcTemplate).withProcedureName("bar").compile();
new SimpleJdbcCall(jdbcTemplate).withProcedureName("").compile();

The first one passes but the second one throws an exception (below). I think both should throw an exception (as there are no stored procedures with those names in the database).

The issue seems to be in GenericCallMetaDataProvider.processProcedureColumns() (code is the same in 4.0.x and master branches). It throws an exception in case more than one sprocs are found and also in case no sproc was found and the name contains a "."
It seems it is missing an else branch to throw an exception for other not found sprocs as well.

org.springframework.dao.InvalidDataAccessApiUsageException: Unable to determine the correct call signature for FOO.BAR - package name should be specified separately using '.withCatalogName("FOO")'
	at org.springframework.jdbc.core.metadata.GenericCallMetaDataProvider.processProcedureColumns(
	at org.springframework.jdbc.core.metadata.GenericCallMetaDataProvider.initializeWithProcedureColumnMetaData(
	at org.springframework.jdbc.core.metadata.CallMetaDataProviderFactory$1.processMetaData(
	at org.springframework.jdbc.core.metadata.CallMetaDataProviderFactory.createMetaDataProvider(
	at org.springframework.jdbc.core.metadata.CallMetaDataContext.initializeMetaData(
	at org.springframework.jdbc.core.simple.AbstractJdbcCall.compileInternal(
	at org.springframework.jdbc.core.simple.AbstractJdbcCall.compile(

The reason why it would be good to have an early exception is to catch missing stored procedures during application startup (when the SimpleJdbcCall is created and compiled) instead only when it is used (sproc is called).

Affects: 4.0.9, 4.2.2

Issue Links:

Referenced from: commits cc06183

Copy link
Collaborator Author

spring-projects-issues commented Nov 11, 2015

Juergen Hoeller commented

Good catch - we were indeed missing an else clause for that check there...


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: data Issues in data modules (jdbc, orm, oxm, tx) type: bug A general bug
None yet

No branches or pull requests

2 participants