-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1792] Throw an exception if there is no result
When running a native query that doesn't return any result (for example, the creation of a stored procedure), `io.vertx.sqlclient.SqlResult#columnsNames` will be null. This commit doesn two things: 1. add null check to avoid a NPE if `.columnsNames` returns null; 2. Throw an HibernateException if the user call getSingleResultOrNull but the query doesn't return any result. Note that we could return null in this situation, but we've decided to be consistent with Hibernate ORM, where the JDBC driver will throw the following exception (with PostgreSQL at least): ``` Caused by: org.postgresql.util.PSQLException: No results were returned by the query. at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:135) at org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.executeQuery(DeferredResultSetAccess.java:240) ```
- Loading branch information
Showing
2 changed files
with
62 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters