allowing HQL formulas in @Formula, @ColumnDefault, @Check, etc #4528
Replies: 6 comments 30 replies
-
I realized that, because of the persister lifecycle, supporting HQL is quite a lot harder than it looks. Instead I propose a semi-generic way to specify dialect-specific native SQL. See #4537. |
Beta Was this translation helpful? Give feedback.
-
Overall I am not a fan of these uber-annotations (one annotation to rule them all if you will). According to this PR, all of these are perfectly legal:
For whatever reason, y'all see this differently than I do whenever we discuss annotation design, but to me it would make much more sense to break these out. At the very least into "valid usage targets". |
Beta Was this translation helpful? Give feedback.
-
I understand the concern about the explosion of annotations. However, the lack of direction for the user as defined (my example) is simply not acceptable. |
Beta Was this translation helpful? Give feedback.
-
You mean in terms of name and placement? One of them you added overriding for ( Not a huge fan of the name
And maybe version (major, minor, micro) makes some sense here? |
Beta Was this translation helpful? Give feedback.
-
Oh, I really like the version selection. It looks good to me |
Beta Was this translation helpful? Give feedback.
-
I'd say leave it as it is until we find such a case. We can always add a new top-level |
Beta Was this translation helpful? Give feedback.
-
Something we've discussed before, but that isn't captured here, is the ability to write HQL expressions in annotations, thus gaining portability across database platforms.
The trickiest part of this is deciding how to identify that the expression is HQL rather than raw SQL.
One solution would be to have some sort of "quoting" syntax, something like
or
@Formula("$concat(x,y)")
or whatever.An alternative would be to have a new member of
@Column
, soor whatever. The advantage I see to this approach is that we could also let you write things like
that is, write the same expression in multiple dialects of SQL.
Beta Was this translation helpful? Give feedback.
All reactions