-
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
Reactive find with lock in Quarkus with reactive hibernate #2117
base: main
Are you sure you want to change the base?
Conversation
...tive-core/src/main/java/org/hibernate/engine/internal/ReactivePersistenceContextAdapter.java
Dismissed
Show dismissed
Hide dismissed
rowProcessingState.finishRowProcessing( true ); | ||
rowReader.finishUp( rowProcessingState ); | ||
jdbcValuesSourceProcessingState.finishUp( false ); | ||
return result; | ||
session.getPersistenceContext(); |
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.
I think you can remove session.getPersistenceContext()
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.
Looks good overall, thanks a lot.
I might just need some clarifications on a couple of changes.
final EventListenerGroup<PostLoadEventListener> listenerGroup = | ||
getSession().getFactory().getEventListenerGroups().eventListenerGroup_POST_LOAD; | ||
final PostLoadEvent postLoadEvent = processingState.getPostLoadEvent(); | ||
return loop( |
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.
In Hibernate ORM the code looks like this:
if ( processingState.getLoadingEntityHolders() != null ) {
final EventListenerGroup<PostLoadEventListener> listenerGroup =
getSession().getFactory().getEventListenerGroups().eventListenerGroup_POST_LOAD;
final PostLoadEvent postLoadEvent = processingState.getPostLoadEvent();
for ( final EntityHolder holder : processingState.getLoadingEntityHolders() ) {
processLoadedEntityHolder( holder, listenerGroup, postLoadEvent, callback, holderConsumer );
}
processingState.getLoadingEntityHolders().clear();
}
if ( processingState.getReloadedEntityHolders() != null ) {
for ( final EntityHolder holder : processingState.getReloadedEntityHolders() ) {
processLoadedEntityHolder( holder, null, null, callback, holderConsumer );
}
processingState.getReloadedEntityHolders().clear();
}
There is not a return
at the end of the first if-then block. It means that the two conditions getLoadingEntityHolders() != null
and processingState.getReloadedEntityHolders() != null
could both be true and both blocks should be evaluated.
Did you add a return loop( ...
because you understand what's going on or is this an error?
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.
probably it can be avoided
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.
What do you mean?
/** | ||
* Reactive equivalent of {@link org.hibernate.sql.exec.internal.CallbackImpl} | ||
*/ | ||
public class ReactiveCallbackImpl implements Callback { |
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.
I think we can remove some code here if
- ReactiveAfterLoadAction extends AfterLoadAction
- ReactiveCallBackImpl extends CallbackImpl
- We add a method
getAfterLoadActions()
in CallBackImpl
But, we can do it in a separate PR, otherwise we will have to wait for the next ORM release.
...-core/src/main/java/org/hibernate/reactive/sql/results/spi/ReactiveSingleResultConsumer.java
Show resolved
Hide resolved
callback, | ||
holderConsumer | ||
)) | ||
.thenAccept( v -> processingState.getLoadingEntityHolders().clear() ); |
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.
I think here it should be using getReloadedEntityHolders
Fix #1905