Skip to content

Commit

Permalink
Fix compilation errors with latest snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Dec 20, 2024
1 parent 8a675e8 commit 71690c2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.hibernate.TransientObjectException;
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
import org.hibernate.bytecode.spi.BytecodeEnhancementMetadata;
import org.hibernate.classic.Lifecycle;
import org.hibernate.engine.internal.CascadePoint;
import org.hibernate.engine.internal.Nullability;
import org.hibernate.engine.spi.EntityEntry;
Expand Down Expand Up @@ -205,17 +204,6 @@ private CompletionStage<Void> fetchAndDelete(DeleteEvent event, DeleteContext tr

}

protected boolean invokeDeleteLifecycle(EventSource session, Object entity, EntityPersister persister) {
if ( persister.implementsLifecycle() ) {
LOG.debug( "Calling onDelete()" );
if ( ( (Lifecycle) entity ).onDelete( session ) ) {
LOG.debug( "Deletion vetoed by onDelete()" );
return true;
}
}
return false;
}

private CompletionStage<Void> deleteTransientInstance(DeleteEvent event, DeleteContext transientEntities, Object entity) {
LOG.trace( "Entity was not persistent in delete processing" );

Expand Down Expand Up @@ -291,31 +279,27 @@ private CompletionStage<Void> delete(
Object version,
EntityEntry entry) {
callbackRegistry.preRemove( entity );
if ( !invokeDeleteLifecycle( source, entity, persister ) ) {
return deleteEntity(
source,
entity,
entry,
event.isCascadeDeleteEnabled(),
event.isOrphanRemovalBeforeUpdates(),
persister,
transientEntities
)
.thenAccept( v -> {
if ( source.getFactory().getSessionFactoryOptions().isIdentifierRollbackEnabled() ) {
persister.resetIdentifier( entity, id, version, source );
}
} );
}
return voidFuture();
return deleteEntity(
source,
entity,
entry,
event.isCascadeDeleteEnabled(),
event.isOrphanRemovalBeforeUpdates(),
persister,
transientEntities
)
.thenAccept( v -> {
if ( source.getFactory().getSessionFactoryOptions().isIdentifierRollbackEnabled() ) {
persister.resetIdentifier( entity, id, version, source );
}
} );
}

/**
* Can we delete the row represented by the proxy without loading the entity?
*/
private boolean canBeDeletedWithoutLoading(EventSource source, EntityPersister persister) {
return source.getInterceptor() == EmptyInterceptor.INSTANCE
&& !persister.implementsLifecycle()
&& !persister.hasSubclasses() //TODO: should be unnecessary, using EntityPersister.getSubclassPropertyTypeClosure(), etc
&& !persister.hasCascadeDelete()
&& !persister.hasNaturalIdentifier()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.hibernate.event.spi.LoadEvent;
import org.hibernate.event.spi.LoadEventListener;
import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper;
import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper.PersistenceContextEntry;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.CompositeIdentifierMapping;
Expand Down Expand Up @@ -652,7 +651,7 @@ private CompletionStage<Object> doLoad(
return nullFuture();
}
else {
final PersistenceContextEntry persistenceContextEntry =
final CacheEntityLoaderHelper.PersistenceContextEntry persistenceContextEntry =
ReactiveCacheEntityLoaderHelper.INSTANCE.loadFromSessionCache( event, keyToLoad, options );
final Object entity = persistenceContextEntry.getEntity();
if ( entity != null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.hibernate.reactive.event.impl;

import org.hibernate.AssertionFailure;
import org.hibernate.classic.Lifecycle;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.PostLoadEvent;
Expand All @@ -21,7 +20,6 @@
/**
* We do two things here:
* <ul>
* <li>Call {@link Lifecycle} interface if necessary</li>
* <li>Perform needed {@link EntityEntry#getLockMode()} related processing</li>
* </ul>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package org.hibernate.reactive.loader.entity;

import static org.hibernate.loader.ast.internal.LoaderHelper.upgradeLock;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ private boolean isProxyInstance(Object proxy) {

// FIXME: I could change the scope of this method in ORM
private Object resolveInstanceFromCache(ReactiveEntityInitializerData data) {
return CacheEntityLoaderHelper.INSTANCE.loadFromSecondLevelCache(
return CacheEntityLoaderHelper.loadFromSecondLevelCache(
data.getRowProcessingState().getSession().asEventSource(),
null,
data.getLockMode(),
Expand Down

0 comments on commit 71690c2

Please sign in to comment.