|
10 | 10 | import java.util.Set;
|
11 | 11 |
|
12 | 12 | import org.hibernate.PessimisticLockException;
|
| 13 | +import org.hibernate.QueryTimeoutException; |
13 | 14 | import org.hibernate.boot.model.FunctionContributions;
|
14 | 15 | import org.hibernate.boot.model.TypeContributions;
|
15 | 16 | import org.hibernate.dialect.aggregate.AggregateSupport;
|
@@ -352,17 +353,19 @@ public ViolatedConstraintNameExtractor getViolatedConstraintNameExtractor() {
|
352 | 353 | public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
|
353 | 354 | return (sqlException, message, sql) -> {
|
354 | 355 | switch ( sqlException.getErrorCode() ) {
|
355 |
| - // If @@innodb_snapshot_isolation is set (default since 11.6.2), |
356 |
| - // if an attempt to acquire a lock on a record that does not exist in the current read view is made, |
357 |
| - // an error DB_RECORD_CHANGED will be raised. |
358 |
| - case 1020: |
359 |
| - return new LockAcquisitionException( message, sqlException, sql ); |
360 |
| - case 1205: |
361 |
| - case 3572: |
| 356 | + case 1205: // ER_LOCK_WAIT_TIMEOUT |
| 357 | + return new LockTimeoutException( message, sqlException, sql ); |
| 358 | + case 3572: // ER_LOCK_NOWAIT |
362 | 359 | return new PessimisticLockException( message, sqlException, sql );
|
363 |
| - case 1207: |
364 |
| - case 1206: |
| 360 | + case 1020: |
| 361 | + // If @@innodb_snapshot_isolation is set (default since 11.6.2), |
| 362 | + // and an attempt to acquire a lock on a record that does not exist |
| 363 | + // in the current read view is made, error DB_RECORD_CHANGED is raised. |
| 364 | + case 1207: // ER_READ_ONLY_TRANSACTION |
| 365 | + case 1206: // ER_LOCK_TABLE_FULL |
365 | 366 | return new LockAcquisitionException( message, sqlException, sql );
|
| 367 | + case 3024: // ER_QUERY_TIMEOUT |
| 368 | + return new QueryTimeoutException( message, sqlException, sql ); |
366 | 369 | case 1062:
|
367 | 370 | // Unique constraint violation
|
368 | 371 | return new ConstraintViolationException( message, sqlException, sql, ConstraintKind.UNIQUE,
|
|
0 commit comments