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

JdbcTemplate queryForObject variants that return NULL instead of throwing an EmptyResultDataAccessException [SPR-9071] #13709

Closed
spring-projects-issues opened this issue Jan 30, 2012 · 2 comments
Assignees
Labels
in: data status: declined type: enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jan 30, 2012

Keith Donald opened SPR-9071 and commented

It sure would be useful if we had queryForObject variants that returned null on no row found cases vs. throwing an exception. Returning null is pretty standard here and supported by other object mappers such as Hibernate and iBatis. Making the developer catching an exception just to return null is verbose and has the cost of creating the exception in the first place. The other workaround -- use query with DataAccessUtils#singleResult(List) -- is also verbose.


Affects: 3.1 GA

Reference URL: http://forum.springsource.org/showthread.php?57232-queryForObject-EmptyResultDataAccessException

7 votes, 4 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 30, 2012

Keith Donald commented

Maybe if instead of new methods on JdbcTemplate we add a configuration option that determines whether null is returned for empty object results?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 22, 2015

Juergen Hoeller commented

Closing groups of outdated issues. Please reopen if still relevant.

@spring-projects-issues spring-projects-issues added status: declined in: data type: enhancement labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data status: declined type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants