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 the batch sequence generation for the 2.x version of H2 #428

Closed
marschall opened this issue Apr 15, 2022 · 4 comments · Fixed by #429
Closed

Fix the batch sequence generation for the 2.x version of H2 #428

marschall opened this issue Apr 15, 2022 · 4 comments · Fixed by #429
Assignees
Labels
Milestone

Comments

@marschall
Copy link
Contributor

Due to h2database/h2database#3483 batch sequence generation is broken on versions 2.x of H2.

There are two possible fixes:

We could special case the H2 dialect and use this query

SELECT NEXT VALUE FOR sequenceName
  FROM SYSTEM_RANGE(1, ?);

Or we could simplify / change the default query to

WITH RECURSIVE T(N) AS (
  SELECT 1
   UNION ALL
  SELECT N + 1
    FROM T
   WHERE N < ?
)
SELECT NEXT VALUE FOR sequenceName
  FROM T;
@vladmihalcea
Copy link
Owner

Thanks for spotting it. Let's change the default query. Would you like to send a Pull Request with the fix?

@marschall
Copy link
Contributor Author

Yes, I can do a PR.

@vladmihalcea
Copy link
Owner

Looking forward to it

marschall added a commit to marschall/hibernate-types that referenced this issue Apr 15, 2022
Change batch sequence query to be simpler
and work with H2 2.x.

Fixes vladmihalcea#428
vladmihalcea pushed a commit that referenced this issue Apr 16, 2022
Change batch sequence query to be simpler
and work with H2 2.x.

Fixes #428
@vladmihalcea vladmihalcea changed the title Batch sequence generation broken on H2 2.x Fix the batch sequence generation for the 2.x version of H2 Apr 16, 2022
@vladmihalcea vladmihalcea added this to the 2.16.1 milestone Apr 16, 2022
@vladmihalcea
Copy link
Owner

Thanks, I integrated it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants