Skip to content

Fix UndeclaredThrowableException masking exceptions during IDENTITY inserts#27

Merged
fprochazka merged 1 commit intomasterfrom
fix/unwrap-invocation-target-exception
Feb 6, 2026
Merged

Fix UndeclaredThrowableException masking exceptions during IDENTITY inserts#27
fprochazka merged 1 commit intomasterfrom
fix/unwrap-invocation-target-exception

Conversation

@fprochazka
Copy link
Member

Summary

  • Unwrap InvocationTargetException in all JDK Proxy InvocationHandler implementations in ObjectBigIntIdIdentityGenerator across hibernate-61, hibernate-62, and hibernate-63 modules
  • Add integration tests that verify ConstraintViolationException propagates without being wrapped in UndeclaredThrowableException

Fixes #26

Test plan

  • IdentityGeneratorExceptionPropagationTest added in all 3 Hibernate modules
  • Each test inserts a duplicate entity to trigger unique constraint violation and asserts the exception is NOT UndeclaredThrowableException
  • ./gradlew build passes

🤖 Generated with Claude Code

…ITY inserts

JDK Proxy InvocationHandlers in ObjectBigIntIdIdentityGenerator were not
unwrapping InvocationTargetException from Method.invoke(), causing the
JDK Proxy to wrap it in UndeclaredThrowableException (with null message).
This masked real exceptions like ConstraintViolationException, making
debugging difficult and breaking catch blocks that expect specific types.

Fixes #26

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fprochazka fprochazka merged commit 488ceaf into master Feb 6, 2026
2 checks passed
@fprochazka fprochazka deleted the fix/unwrap-invocation-target-exception branch February 6, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UndeclaredThrowableException masks actual exceptions during entity INSERT with ObjectBigIntId

1 participant