Skip to content
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

HHH-7180 Test and fix wrong collection key equality comparisons #9603

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

beikov
Copy link
Contributor

@beikov beikov commented Jan 10, 2025


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-7180

@@ -126,7 +126,7 @@
Object id = getIdentifier( session, ref );

// only evict if the related entity has changed
if ( ( id != null && !id.equals( oldId ) ) || ( oldId != null && !oldId.equals( id ) ) ) {
if ( ( id != null || oldId != null ) && !collectionPersister.getKeyType().isEqual( oldId, id ) ) {

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
CollectionPersister.getKeyType
should be avoided because it has been deprecated.
@@ -39,7 +39,7 @@
CollectionPersister persister, Object id, PersistentCollection<?> snapshot) {
return isCollectionSnapshotValid( snapshot )
&& persister.getRole().equals( snapshot.getRole() )
&& id.equals( snapshot.getKey() );
&& persister.getKeyType().isEqual( id, snapshot.getKey() );

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
CollectionPersister.getKeyType
should be avoided because it has been deprecated.
public void cleanup(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery( "delete from Child" ).executeUpdate();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
scope.inTransaction(
session -> {
session.createQuery( "delete from Child" ).executeUpdate();
session.createQuery( "delete from Parent" ).executeUpdate();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
@beikov beikov merged commit b03b25e into hibernate:main Jan 10, 2025
22 of 24 checks passed
@beikov beikov deleted the HHH-7180 branch January 10, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant