-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
propose @DialectOverride annotation #4537
Conversation
@@ -94,7 +96,8 @@ void tearDown(SessionFactoryScope scope) { | |||
|
|||
private Double rate; | |||
|
|||
@Formula(value = "credit * rate") | |||
@Formula(value = "credit * rate", | |||
overrides = @DialectOverride(dialect = H2Dialect.class, value ="rate * credit") ) | |||
private Double interest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example of how you might use it, but it's much more general than this.
336f4ce
to
feec9a0
Compare
feec9a0
to
4f6c449
Compare
Currently the API for this looks like: @Formula(value = "credit * rate",
overrides = @DialectOverride(dialect = H2Dialect.class, value = "rate * credit") ) I guess an alternative way to do it, that has less impact on the existing annotations, would be to write: @Formula(value = "credit * rate")
@DialectOverride(annotation = Formula.class, dialect = H2Dialect.class, value = "rate * credit") I'm unclear on which option is "better". I guess they're pretty equivalent. |
4f6c449
to
5b35ba4
Compare
5b35ba4
to
2f5dae4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me, but let's discuss the design first in #4528
This allows the use of native SQL in annotations of portable programs. We've needed something like this for a long time.
2f5dae4
to
a609cff
Compare
Superseded by #4607. |
This allows the use of native SQL in annotations of portable programs.
We've needed something like this for a long time.