HHH-18196 - Remove Session#save / Session#update / Session#saveOrUpdate

HHH-18428 - Remove Session#delete

Javadoc fix-ups
This commit is contained in:
Steve Ebersole 2024-07-29 15:15:17 -05:00
parent d8c2ca7824
commit f170d5637f
13 changed files with 23 additions and 51 deletions

View File

@ -309,7 +309,6 @@ public interface Interceptor {
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @see Session#remove(Object)
* @see Session#delete(Object)
*
* @deprecated Use {@link #onRemove(Object, Object, Object[], String[], Type[])}
*/

View File

@ -23,8 +23,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* <p>
*
* @author Steve Ebersole
*
* @see SelectBeforeUpdate
*/
@Target( TYPE )
@Retention( RUNTIME )

View File

@ -720,10 +720,11 @@ public interface SessionFactoryBuilder {
SessionFactoryBuilder enableJpaListCompliance(boolean enabled);
/**
* @see JpaCompliance#isJpaCascadeComplianceEnabled()
* @deprecated No longer has any effect.
*
* @see org.hibernate.cfg.AvailableSettings#JPA_CASCADE_COMPLIANCE
* @see JpaCompliance#isJpaCascadeComplianceEnabled()
*/
@Deprecated(since = "7.0", forRemoval = true)
SessionFactoryBuilder enableJpaCascadeCompliance(boolean enabled);
/**

View File

@ -63,17 +63,10 @@ public interface JpaComplianceSettings {
String JPA_QUERY_COMPLIANCE = "hibernate.jpa.compliance.query";
/**
* Controls whether Hibernate applies cascade
* {@link jakarta.persistence.CascadeType#PERSIST} or
* {@link org.hibernate.annotations.CascadeType#SAVE_UPDATE}
* at flush time. If enabled, Hibernate will cascade the standard
* JPA {@code PERSIST} operation. Otherwise, Hibernate will cascade
* the legacy {@code SAVE_UPDATE} operation.
*
* @settingDefault {@link #JPA_COMPLIANCE}
*
* @since 6.6
* @deprecated No longer has any effect. Since 7.0 (and removal of save/update processing),
* Hibernate always cascades {@linkplain jakarta.persistence.CascadeType#PERSIST PERSIST}
*/
@Deprecated
String JPA_CASCADE_COMPLIANCE = "hibernate.jpa.compliance.cascade";
/**

View File

@ -80,11 +80,11 @@ public class CascadingActions {
};
/**
* @see org.hibernate.Session#delete(Object)
* Used in legacy {@code Session#delete} method, which has been removed
*
* @deprecated Use {@link #REMOVE}
*/
@Deprecated(since = "6.6")
@Deprecated(since = "6.6", forRemoval = true)
public static final CascadingAction<DeleteContext> DELETE = REMOVE;
/**

View File

@ -53,11 +53,8 @@ public abstract class AbstractFlushingEventListener implements JpaBootstrapSensi
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AbstractFlushingEventListener.class.getName() );
private boolean jpaBootstrap;
@Override
public void wasJpaBootstrap(boolean wasJpaBootstrap) {
this.jpaBootstrap = wasJpaBootstrap;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -205,10 +202,6 @@ public abstract class AbstractFlushingEventListener implements JpaBootstrapSensi
return CascadingActions.PERSIST_ON_FLUSH;
}
private static boolean isJpaCascadeComplianceEnabled(EventSource session) {
return session.getSessionFactory().getSessionFactoryOptions().getJpaCompliance().isJpaCascadeComplianceEnabled();
}
/**
* Initialize the flags of the CollectionEntry, including the
* dirty check.
@ -284,14 +277,13 @@ public abstract class AbstractFlushingEventListener implements JpaBootstrapSensi
EventSource source,
Object key,
EntityEntry entry) {
final FlushEntityEvent entityEvent = possiblyValidExistingInstance;
if ( entityEvent == null || !entityEvent.isAllowedToReuse() ) {
if ( possiblyValidExistingInstance == null || !possiblyValidExistingInstance.isAllowedToReuse() ) {
//need to create a new instance
return new FlushEntityEvent( source, key, entry );
}
else {
entityEvent.resetAndReuseEventInstance( key, entry );
return entityEvent;
possiblyValidExistingInstance.resetAndReuseEventInstance( key, entry );
return possiblyValidExistingInstance;
}
}

View File

@ -8,11 +8,15 @@ package org.hibernate.event.spi;
import java.util.IdentityHashMap;
import org.hibernate.event.internal.DefaultDeleteEventListener;
/**
* A {@link DeleteEvent} represents a {@linkplain org.hibernate.Session#delete(Object) delete operation}
* A {@link DeleteEvent} represents a {@linkplain org.hibernate.Session#remove delete operation}
* applied to a single entity. A {@code DeleteContext} is propagated across all cascaded delete operations,
* and keeps track of all the entities we've already visited.
*
* @see DefaultDeleteEventListener#onDelete(DeleteEvent, DeleteContext)
*
* @author Gavin King
*/
public interface DeleteContext {

View File

@ -26,7 +26,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
private boolean closedCompliance;
private boolean cachingCompliance;
private boolean loadByIdCompliance;
private boolean cascadeCompliance;
public MutableJpaComplianceImpl(Map<?,?> configurationSettings) {
this(
@ -39,11 +38,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
public MutableJpaComplianceImpl(Map<?,?> configurationSettings, boolean jpaByDefault) {
final Object legacyQueryCompliance = configurationSettings.get( AvailableSettings.JPAQL_STRICT_COMPLIANCE );
cascadeCompliance = ConfigurationHelper.getBoolean(
AvailableSettings.JPA_CASCADE_COMPLIANCE,
configurationSettings,
jpaByDefault
);
//noinspection deprecation
listCompliance = ConfigurationHelper.getBoolean(
AvailableSettings.JPA_LIST_COMPLIANCE,
@ -103,7 +97,7 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
}
public boolean isJpaCascadeComplianceEnabled() {
return cascadeCompliance;
return true;
}
@Override
@ -151,7 +145,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
@Override
public void setCascadeCompliance(boolean cascadeCompliance) {
this.cascadeCompliance = cascadeCompliance;
}
@Override
@ -197,7 +190,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
public JpaCompliance immutableCopy() {
JpaComplianceImpl.JpaComplianceBuilder builder = new JpaComplianceImpl.JpaComplianceBuilder();
builder = builder.setListCompliance( listCompliance )
.setCascadeCompliance( cascadeCompliance )
.setProxyCompliance( proxyCompliance )
.setOrderByMappingCompliance( orderByMappingCompliance )
.setGlobalGeneratorNameCompliance( generatorNameScopeCompliance )

View File

@ -81,14 +81,9 @@ public interface JpaCompliance {
boolean isJpaClosedComplianceEnabled();
/**
* JPA specifies that a {@link jakarta.persistence.CascadeType#PERSIST}
* operation should occur at flush time. The legacy behavior of Hibernate
* was a {@link org.hibernate.annotations.CascadeType#SAVE_UPDATE}.
*
* @return {@code true} indicates to behave in the spec-defined way
*
* @see org.hibernate.cfg.AvailableSettings#JPA_CASCADE_COMPLIANCE
* @deprecated No longer has any effect.
*/
@Deprecated(since = "7.0")
boolean isJpaCascadeComplianceEnabled();
/**

View File

@ -10,6 +10,10 @@ package org.hibernate.jpa.spi;
* @author Steve Ebersole
*/
public interface MutableJpaCompliance extends JpaCompliance {
/**
* @deprecated Always enabled. See {@linkplain JpaCompliance#isJpaCascadeComplianceEnabled()}
*/
@Deprecated
void setCascadeCompliance(boolean cascadeCompliance);
void setListCompliance(boolean listCompliance);

View File

@ -12,8 +12,6 @@
* Deprecated, use {@link org.hibernate.query.TupleTransformer}
* and/or {@link org.hibernate.query.ResultListTransformer}
* which are defined in {@link org.hibernate.query}.
*
* @deprecated The contents of this package are deprecated
*/
@Deprecated
package org.hibernate.transform;

View File

@ -11,9 +11,6 @@
* <p>
* Value-generation related contracts have been replaced by
* {@link org.hibernate.generator}
*
* @deprecated The contents of this package and its subpackages
* are deprecated
*/
@Remove @Deprecated
package org.hibernate.tuple;

View File

@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
@DomainModel(annotatedClasses =
{CascadePersistSFTest.Parent.class,
CascadePersistSFTest.Child.class})
@ServiceRegistry(settings = @Setting(name=JpaComplianceSettings.JPA_CASCADE_COMPLIANCE,value="true"))
public class CascadePersistSFTest {
@Test void test(SessionFactoryScope scope) {
Parent p = new Parent();