Skip to content

different approach to overriding SQL in annotations #4607

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
Jan 20, 2022

Conversation

gavinking
Copy link
Member

Introduces the @ForDialect annotation, which is really a perfectly elegant thing if you're careful not to look at its implementation.

This approach has the advantage that it doesn't impact the existing annotations at all: it's completely self-contained.

See #4528.

@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 9, 2022
@gavinking
Copy link
Member Author

gavinking commented Jan 9, 2022

Note, with this new annotation, you can write things like:

@Entity(name = "Person")
@Check(constraints = "code > 0")
@ForDialect(dialect = H2Dialect.class, 
            check = @Check(constraints = "sign(code) = 1"))
public static class Person { ... }

@gavinking gavinking added the 6.0 label Jan 9, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 9, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 16, 2022
@gavinking gavinking force-pushed the for_dialect branch 3 times, most recently from f052b8c to 543e3f1 Compare January 18, 2022 19:23
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 18, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 18, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 18, 2022
@gavinking gavinking force-pushed the for_dialect branch 2 times, most recently from ea3a9c8 to 6989bf3 Compare January 18, 2022 22:32
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 18, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 19, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 19, 2022
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 19, 2022
@gavinking
Copy link
Member Author

Does anyone know what's up with MySQL and Maria? Why they keep timing out?

@beikov
Copy link
Member

beikov commented Jan 20, 2022

Can you rebase? I fixed the hanging yesterday evening.

for overriding certain mapping annotations that specify native SQL
@gavinking
Copy link
Member Author

I fixed the hanging yesterday evening.

Thanks, that worked.

@gavinking gavinking merged commit 019f871 into hibernate:main Jan 20, 2022
@gavinking
Copy link
Member Author

gavinking commented Jan 20, 2022

I have merged this. It's marked @Incubating, and it's very under-tested, since some of this is quite hard to write tests for. Hell, I noticed that we have no tests for @Check at all. Let's see if people find it useful.

@gavinking gavinking deleted the for_dialect branch June 15, 2023 11:03
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 this pull request may close these issues.

2 participants