-
Notifications
You must be signed in to change notification settings - Fork 92
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
[#1504] Merge with reference fails if entity is associated to a column (non id) #1685
Conversation
String uniqueKeyPropertyName = entityType.getRHSUniqueKeyPropertyName(); | ||
Object propertyValue = entityPersister.getPropertyValue( value, uniqueKeyPropertyName ); | ||
// We now have the value of the property-ref we reference. However, | ||
// we need to dig a little deeper, as that property might also be | ||
// an entity type, in which case we need to resolve its identifier | ||
Type type = entityPersister.getPropertyType( uniqueKeyPropertyName ); | ||
final Type type = entityPersister.getPropertyType( uniqueKeyPropertyName ); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
// We now have the value of the property-ref we reference. However, | ||
// we need to dig a little deeper, as that property might also be | ||
// an entity type, in which case we need to resolve its identifier | ||
final Type type = entityPersister.getPropertyType( uniqueKeyPropertyName ); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
session | ||
); | ||
loadedUniqueKey = ((CompletableFuture)resultObject).get(); | ||
} |
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.
You should not use a .get()
because it's a blocking method.
Assuming the logic is correct (I haven't cheked yet), the code should look something like:
.thenCompose ukResult -> {
...
if ( loadedUniqueKey instanceof HibernateProxy ) {
return loadHibernateProxyEntity( ... )
.thenApply(loadedUniqueKey -> { .... } );
}
...
}
42cd05f
to
d840f80
Compare
Thanks, looks good. I've just decided to keep the original tests and took the opportunity to clean up a bit the code and remove some warnings in EntityTypes: #1696 |
fixes #1504
The two tests were failing because the
Bar
entity column was still aHibernateProxy
object inEntityTypes
methods so the identifierBar.key
value was always null.The fixes I implemented check for the proxy and force a load via
reactiveImmediateLoad()