-
Notifications
You must be signed in to change notification settings - Fork 934
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
Support mixed formulas and columns #1808
Support mixed formulas and columns #1808
Conversation
@@ -6,18 +6,15 @@ | |||
<property name="Name" /> | |||
</class> | |||
|
|||
<!-- | |||
Mapping to demonstrate that the 'column' attribute takes precedence over a 'column' element - and, for consistency, | |||
the same behaviour applies to the generator attribute/element |
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.
Wrong for column
: that was the element which was taking precedence.
(NH-1007 is about adding the generator
attribute as an alternate to specifying the element, when the user just needs to specify the generator name.)
|
||
<property name="Name" column="Name"> | ||
<column name="InvalidColumnName" /> | ||
</property> |
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.
It was demonstrating nothing, since InvalidColumnName
is a valid column name. And it was actually the name used in database.
What's the precedence of elements and tags in other cases (eg. generators, etc.)? |
As implied by this comment, in the case of For As already written, for |
Ok, can we investigate Hibernate then? |
Hibernate does not support the For For But maybe there is some validity checks done before parsing that I have not spotted. |
Many mapping elements allow to define their columns or formulas by nested elements, but most of them do not support having both nested columns and formulas. Follow-up to NH-2117, which has added this support to one-to-many.
Throw on invalid usages of columns and formulas attributes and elements
Use a more robust checking of sub-elements existence
bfda09b
to
3d5e32a
Compare
There is some cleanup required regards using of interpolated strings ( |
Remove superfluous string interpolation
I have made the cleanup. Do you consider your first approval as still holding true? |
I’ll double check, but in principle - yes. I wanted to check something regarding the interfaces implemented (I think some of the classes are missing some interfaces, but I don’t remember the details) |
Maybe you are thinking about one case which allows a nested |
I have rechecked this, and spotted no forgotten case. So, As proposed on the development group, and since no continued grounded disagreement has been expressed there since one week after raised concerns being addressed, I intend to merge this PR next week (likely on Wednesday). (I am issuing this notice on PR issued before starting to apply this handling of merges. I will not do it for new PR.) |
Many mapping elements allow to define their columns or formulas by nested elements, but most of them do not support having both nested columns and formulas.
Follow-up to NH-2117, which has added this support to one-to-many.
Why not qualifying this as a bug by the way, since nothing tells anywhere columns and formulas are not to be mixed.
A workaround could be in some cases to use formulas for columns too, but that can cause troubles to the DDL generation, as it cannot detect columns needing to be created when they are mapped as formulas.
This issue was spotted while checking this example.
This PR is #1759 rebased and squashed without the mapping-by-code part, since this part has some debate on its method naming, causing it to be blocked.
Possible breaking change:
<element>
mapping). They will now throw.