Skip to content

Validate identity generated id for CockroachDB #1339

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

Merged
merged 2 commits into from
Jun 14, 2022

Conversation

DavideD
Copy link
Member

@DavideD DavideD commented Jun 14, 2022

Fix #1338

The error message now looks like:

org.hibernate.HibernateException: HR000073: java.lang.Short is an invalid identity type when using CockroachDB (entity org.hibernate.reactive.IdentityGeneratorTypeForCockroachDBTest$ShortTypeEntity) - CockroachDB might generates identifiers that are too big and won't always fit in a java.lang.Short. java.lang.Long is valid replacement

I don't think this was a critical issue before because we threw exceptions based on the size of the identifiers.
But this should give users more info about what's going on.

It would be nicer to validate this at startup

@DavideD DavideD requested a review from gavinking June 14, 2022 12:35
@DavideD DavideD force-pushed the 1338-error-message branch from aced297 to f61c87e Compare June 14, 2022 12:39
@DavideD DavideD requested a review from blafond June 14, 2022 12:46
Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

I would prefer a shorter message, but otherwise it looks fine.

Copy link
Member

@blafond blafond left a comment

Choose a reason for hiding this comment

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

Ran locally fine. good changes to asserting error message content.

Looks good.

@blafond blafond merged commit 4d1df78 into hibernate:main Jun 14, 2022
@DavideD
Copy link
Member Author

DavideD commented Jun 14, 2022

Thanks

@DavideD DavideD deleted the 1338-error-message branch September 1, 2022 09:02
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.

Throw better exception when using CockroachDB with Identity and the type is not long
3 participants