Commit 26d96e9
committed
[#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)
```1 parent db4c3b5 commit 26d96e9
File tree
2 files changed
+62
-20
lines changed- hibernate-reactive-core/src/main/java/org/hibernate/reactive
- adaptor/impl
- sql/results/internal
2 files changed
+62
-20
lines changedLines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
202 | | - | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
| 211 | + | |
207 | 212 | | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
211 | 226 | | |
212 | 227 | | |
213 | 228 | | |
| |||
368 | 383 | | |
369 | 384 | | |
370 | 385 | | |
371 | | - | |
| 386 | + | |
372 | 387 | | |
373 | 388 | | |
374 | 389 | | |
| |||
379 | 394 | | |
380 | 395 | | |
381 | 396 | | |
382 | | - | |
| 397 | + | |
383 | 398 | | |
384 | 399 | | |
385 | 400 | | |
386 | 401 | | |
387 | | - | |
| 402 | + | |
388 | 403 | | |
389 | 404 | | |
390 | 405 | | |
| |||
502 | 517 | | |
503 | 518 | | |
504 | 519 | | |
505 | | - | |
| 520 | + | |
506 | 521 | | |
507 | 522 | | |
508 | 523 | | |
| |||
865 | 880 | | |
866 | 881 | | |
867 | 882 | | |
868 | | - | |
| 883 | + | |
869 | 884 | | |
870 | 885 | | |
871 | 886 | | |
| |||
Lines changed: 40 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | | - | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
172 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
173 | 189 | | |
174 | 190 | | |
175 | 191 | | |
| |||
185 | 201 | | |
186 | 202 | | |
187 | 203 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
| 204 | + | |
196 | 205 | | |
197 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
198 | 225 | | |
199 | | - | |
| 226 | + | |
200 | 227 | | |
201 | 228 | | |
202 | 229 | | |
| |||
0 commit comments