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

fix: EXPOSED-621 IllegalStateException on accessing autoincrement column after insert using Entity #2291

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

joc-a
Copy link
Collaborator

@joc-a joc-a commented Oct 31, 2024

Description

  • Why:
    The issue was that the hashCode() function was using sequence which invokes autoincSeq if _sequence is null, which then invokes currentDialect, and if this is not within a transaction, it will throw an error. This was introduced here.
  • How:
    The fix is to use _sequence instead of sequence when generating a hashcode.

Type of Change

Please mark the relevant options with an "X":

  • Bug fix
  • New feature
  • Documentation update

Updates/remove existing public API methods:

  • Is breaking change

Affected databases:

  • MariaDB
  • Mysql5
  • Mysql8
  • Oracle
  • Postgres
  • SqlServer
  • H2
  • SQLite

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)
  • All public methods affected by my PR has up to date API docs
  • Documentation for my change is up to date

Related Issues

@joc-a joc-a marked this pull request as ready for review November 1, 2024 10:07
@joc-a joc-a requested a review from bog-walk November 1, 2024 11:45
Copy link
Member

@bog-walk bog-walk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor fyi about the test.

…umn after insert using Entity

The issue was that the `hashCode()` function was using `sequence` which invokes `autoincSeq` if `_sequence` is null, which then invokes `currentDialect`, and if this is not within a transaction, it will throw an error. The fix is to use `_sequence` instead of `sequence` when generating a hashcode.
@joc-a joc-a merged commit f982b5f into main Nov 4, 2024
5 checks passed
@joc-a joc-a deleted the joc/exposed-621 branch November 4, 2024 10:58
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.

2 participants