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

different approach to overriding SQL in annotations #4607

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
Copy link
Member Author

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

@beikov
Copy link
Contributor

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
2 participants