Skip to content

Conversation

@gavinking
Copy link
Member

This allows the use of native SQL in annotations of portable programs.

We've needed something like this for a long time.

@gavinking gavinking added the 6.0 label Dec 29, 2021
@gavinking gavinking requested a review from sebersole December 29, 2021 19:44
@hibernate hibernate deleted a comment from hibernate-github-bot bot Dec 29, 2021
@Formula(value = "credit * rate")
@Formula(value = "credit * rate",
overrides = @DialectOverride(dialect = H2Dialect.class, value ="rate * credit") )
private Double interest;
Copy link
Member Author

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.

@gavinking
Copy link
Member Author

gavinking commented Dec 29, 2021

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.

Copy link
Member

@beikov beikov left a 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.
@hibernate hibernate deleted a comment from hibernate-github-bot bot Jan 9, 2022
@gavinking
Copy link
Member Author

Superseded by #4607.

@gavinking gavinking closed this Jan 20, 2022
@gavinking gavinking deleted the dialect-override branch June 15, 2023 11:08
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