-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
HHH-15848 Session.isDirty() and more (rebase) #9476
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
Conversation
code cleanups to EntityPrinter
|
Thanks for your pull request! This pull request does not follow the contribution rules. Could you have a look? ❌ All commit messages should start with a JIRA issue key matching pattern › This message was automatically generated. |
| // TODO: why do we not check !lazinessInterceptor.hasWrittenFieldNames() | ||
| // as we do below in isNonDirtyViaTracker() ? |
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.
@dreab8 This is a question for you.
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.
@gavinking with dirty checking setting a property will not trigger the initialization, while without dirty checking setting a property triggers the enhamced proxy initilaization and then the interceptor would not be of type EnhancementAsProxyLazinessInterceptor
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.
basically writtenFieldNames is populated only when dirty checking is enabled
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.
@dreab8 I guess I don't understand what is the difference between the two branches. They both do:
if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) {and then one of them does the additional check, and one doesn't.
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.
@gavinking one branch deals wit the case dirty checking is not enabled, in this case it's enough interceptor instanceof EnhancementAsProxyLazinessInterceptor to be sure it's not dirty, the other branch deals with the case dirty checking is enabled and if interceptor instanceof EnhancementAsProxyLazinessInterceptor we need also to be sure it has not written field names to say that it's not dirty
this is definitely not perfect yet, but it's certainly a much better foundation than the ancient implementation which was bad and side-effecty in all sorts of ways
and add a TODO (a question for @dreab8)
| && !collection.isDirty() //optimization | ||
| && loadedPersister != null | ||
| && loadedPersister.isMutable() //optimization | ||
| && ( collection.isDirectlyAccessible() || loadedPersister.getElementType().isMutable() ) //optimization |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
CollectionPersister.getElementType
| private static boolean isCollectionDirty(PersistentCollection<?> collection, CollectionPersister loadedPersister) { | ||
| return collection.isDirty() | ||
| || collection.wasInitialized() | ||
| && loadedPersister != null |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
CollectionPersister.getElementType
| } | ||
| else { | ||
| assert uniqueKeyPropertyName != null; | ||
| final Type keyType = persister.getPropertyType( uniqueKeyPropertyName ); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
EntityPersister.getPropertyType
| // 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 Note
EntityPersister.getPropertyType
| log.debugf("Flushing to force deletion of re-saved object: " | ||
| + infoString( key.getPersister(), key.getIdentifier(), getFactory() ) ); |
Check failure
Code scanning / CodeQL
Insertion of sensitive information into log files High
Supersedes #9379
[Please describe here what your change is about]
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-15848