HHH-19555 tests and doc
@SQLRestriction on a @ManyToOne @JoinTable is currently mostly-working, by accident.
This PR documents this possibility, and adds tests for it.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion. For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19555
Fails on databases with merge emulation due to this condition in OptionalTableUpdateOperation:
if ( valuesAnalysis.getTablesWithPreviousNonNullValues().contains( tableMapping ) ) {
@gavinking rebased the upsert impls for edb and hsql, and disabled the test for sybase. All tests green now. Over to you :+1:
Nice! Thanks man!
We need to think what to do about Sybase (i.e. produce an error at startup or whatever, not quite sure.)
Nice! Thanks man!
We need to think what to do about Sybase (i.e. produce an error at startup or whatever, not quite sure.)
Add an supportsSqlRestrictionOnJoinTableManyToOne by default true except for Sybase dialects in Dialect ?
Nice! Thanks man! We need to think what to do about Sybase (i.e. produce an error at startup or whatever, not quite sure.)
Add an
supportsSqlRestrictionOnJoinTableManyToOneby default true except for Sybase dialects inDialect?
Maybe rather supportsUpsert (or whatever it's named, it probably exists) + an error message stating that it's only supported on database with upsert support?
WDYT @gavinking?
There's a comment on the issue:
I have found a second problem with this. All is well as long as such an association is fetched eagerly using a join. But for
LAZYfetching, the restriction is never applied. So I would need @mbellade to help us repurpose the stuff done for@ConcreteProxyto add an extra “look-ahead” join with the restriction. I attempted to make this work myself, but I failed.
I'm not sure that this problem has been addressed yet. I'm guessing not. I don't think we can merge this until that part of it is done.
Thanks for your pull request!
This pull request appears to follow the contribution rules.
› This message was automatically generated.
Alright, so, based on my testing, we have two options here:
- disable this functionality for the two cases where we know it's currently broken:
-
fetch=LAZY, and - Sybase
-
- disable on Sybase, and fix the problem with lazy fetching by repurposing the
@ConcreteProxy-style lookahead.
Apparently I tried to do 2 when I first looked at this, and couldn't figure it out, so we would need Marco's help on it.
Anyway, I have added tests.