While upgrading Hibernate, I encountered this issue:
ValueProviderTest::testDeletion() (and other tests) fails on creating AliasProvider.
The issue lies in ValueProvider::modifyFromApi().
It gets ValueProviderCapability from the resource, but the ValueProviderCapability has not set ValueProvider (it is null).
However, when the ValueProviderCapability has been created, it did have ValueProvider.
Also, I tried Joining the entities with a query which returned (1, 2, 2, 1).
SELECT valCap.id, valCap.value_provider_id, vp.id, vp.capability_id FROM resource r" +
" JOIN capability c ON c.resource_id = r.id" +
" JOIN value_provider_capability valCap ON valCap.id = c.id" +
" JOIN value_provider vp ON valCap.value_provider_id = vp.id" +
" WHERE r.id = :resourceId
This is why I suspect that Hibernate is not correctly mapping the entities together.
I think that the issue might be in the mappings:
@Entity
public class ValueProviderCapability extends Capability
@OneToOne(cascade = CascadeType.ALL)
@Access(AccessType.FIELD)
public ValueProvider getValueProvider() { return valueProvider; }
}
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class ValueProvider extends SimplePersistentObject {
@ManyToOne
@Access(AccessType.FIELD)
public Capability getCapability() { return capability; }
}
Also, I find the resulting relationship peculiar. value_provider holds capability_id, and value_provider_capability holds value_provider_id. It seems to me like a bidirectional relationship.
TABLE value_provider
| dtype |
id |
type |
allow_any_requested_value |
capability_id |
value_provider_id |
| PatternValueProvider |
33 |
|
t |
32 |
|
| PatternValueProvider |
59 |
|
f |
58 |
|
| FilteredValueProvider |
1252 |
CONVERT_TO_URL |
f |
1251 |
33 |
TABLE value_provider_capability
| id |
value_provider_id |
| 32 |
33 |
While upgrading
Hibernate, I encountered this issue:ValueProviderTest::testDeletion()(and other tests) fails on creatingAliasProvider.The issue lies in
ValueProvider::modifyFromApi().It gets
ValueProviderCapabilityfrom the resource, but theValueProviderCapabilityhas not setValueProvider(it isnull).However, when the
ValueProviderCapabilityhas been created, it did haveValueProvider.Also, I tried Joining the entities with a query which returned (
1, 2, 2, 1).This is why I suspect that Hibernate is not correctly mapping the entities together.
I think that the issue might be in the mappings:
Also, I find the resulting relationship peculiar.
value_providerholdscapability_id, andvalue_provider_capabilityholdsvalue_provider_id. It seems to me like a bidirectional relationship.TABLE value_providerTABLE value_provider_capability