HHH-18443 - Drop SessionFactoryBuilder#enableJpaListCompliance

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2024-07-29 23:01:02 +02:00 committed by Steve Ebersole
parent dcc9f66d78
commit 8eb7d5457e
13 changed files with 1 additions and 126 deletions

View File

@ -709,16 +709,6 @@ public interface SessionFactoryBuilder {
*/ */
SessionFactoryBuilder enableJpaTransactionCompliance(boolean enabled); SessionFactoryBuilder enableJpaTransactionCompliance(boolean enabled);
/**
* @see JpaCompliance#isJpaListComplianceEnabled()
*
* @see org.hibernate.cfg.AvailableSettings#JPA_LIST_COMPLIANCE
*
* @deprecated Use {@link org.hibernate.cfg.AvailableSettings#DEFAULT_LIST_SEMANTICS} instead
*/
@Deprecated( since = "6.0" )
SessionFactoryBuilder enableJpaListCompliance(boolean enabled);
/** /**
* @deprecated No longer has any effect. * @deprecated No longer has any effect.
* *

View File

@ -404,12 +404,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
return this; return this;
} }
@Override
public SessionFactoryBuilder enableJpaListCompliance(boolean enabled) {
this.optionsBuilder.enableJpaListCompliance( enabled );
return this;
}
@Override @Override
public SessionFactoryBuilder enableJpaCascadeCompliance(boolean enabled) { public SessionFactoryBuilder enableJpaCascadeCompliance(boolean enabled) {
this.optionsBuilder.enableJpaCascadeCompliance( enabled ); this.optionsBuilder.enableJpaCascadeCompliance( enabled );

View File

@ -1574,10 +1574,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
mutableJpaCompliance().setTransactionCompliance( enabled ); mutableJpaCompliance().setTransactionCompliance( enabled );
} }
public void enableJpaListCompliance(boolean enabled) {
mutableJpaCompliance().setListCompliance( enabled );
}
public void enableJpaCascadeCompliance(boolean enabled) { public void enableJpaCascadeCompliance(boolean enabled) {
mutableJpaCompliance().setCascadeCompliance( enabled ); mutableJpaCompliance().setCascadeCompliance( enabled );
} }

View File

@ -374,12 +374,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
return getThis(); return getThis();
} }
@Override
public T enableJpaListCompliance(boolean enabled) {
delegate.enableJpaListCompliance( enabled );
return getThis();
}
@Override @Override
public T enableJpaClosedCompliance(boolean enabled) { public T enableJpaClosedCompliance(boolean enabled) {
delegate.enableJpaClosedCompliance( enabled ); delegate.enableJpaClosedCompliance( enabled );

View File

@ -19,7 +19,6 @@ public interface JpaComplianceSettings {
* *
* @see #JPA_TRANSACTION_COMPLIANCE * @see #JPA_TRANSACTION_COMPLIANCE
* @see #JPA_QUERY_COMPLIANCE * @see #JPA_QUERY_COMPLIANCE
* @see #JPA_LIST_COMPLIANCE
* @see #JPA_ORDER_BY_MAPPING_COMPLIANCE * @see #JPA_ORDER_BY_MAPPING_COMPLIANCE
* @see #JPA_CLOSED_COMPLIANCE * @see #JPA_CLOSED_COMPLIANCE
* @see #JPA_PROXY_COMPLIANCE * @see #JPA_PROXY_COMPLIANCE
@ -69,33 +68,6 @@ public interface JpaComplianceSettings {
@Deprecated @Deprecated
String JPA_CASCADE_COMPLIANCE = "hibernate.jpa.compliance.cascade"; String JPA_CASCADE_COMPLIANCE = "hibernate.jpa.compliance.cascade";
/**
* Controls whether Hibernate should treat what it would usually consider a
* {@linkplain org.hibernate.collection.spi.PersistentBag "bag"}, that is, a
* list with no index column, whose element order is not persistent, as a true
* {@link org.hibernate.collection.spi.PersistentList list} with an index column
* and a persistent element order.
*
* @apiNote If enabled, Hibernate will recognize it as a list where the
* {@link jakarta.persistence.OrderColumn} annotation is simply missing
* (and its defaults will apply).
*
* @settingDefault {@link #JPA_COMPLIANCE}
*
* @see org.hibernate.jpa.spi.JpaCompliance#isJpaListComplianceEnabled()
* @see org.hibernate.boot.SessionFactoryBuilder#enableJpaListCompliance(boolean)
*
* @since 5.3
*
* @deprecated Use {@link MappingSettings#DEFAULT_LIST_SEMANTICS} instead. The specification
* actually leaves this behavior undefined, saying that portable applications
* should not rely on any specific behavior for a {@link java.util.List} with
* no {@code @OrderColumn}.
*/
@Deprecated( since = "6.0" )
@SuppressWarnings("DeprecatedIsStillUsed")
String JPA_LIST_COMPLIANCE = "hibernate.jpa.compliance.list";
/** /**
* JPA specifies that items occurring in {@link jakarta.persistence.OrderBy} * JPA specifies that items occurring in {@link jakarta.persistence.OrderBy}
* lists must be references to entity attributes, whereas Hibernate, by default, * lists must be references to entity attributes, whereas Hibernate, by default,

View File

@ -12,7 +12,6 @@ import org.hibernate.jpa.spi.JpaCompliance;
* @author Andrea Boriero * @author Andrea Boriero
*/ */
public class JpaComplianceImpl implements JpaCompliance { public class JpaComplianceImpl implements JpaCompliance {
private final boolean listCompliance;
private final boolean orderByMappingCompliance; private final boolean orderByMappingCompliance;
private final boolean proxyCompliance; private final boolean proxyCompliance;
private final boolean globalGeneratorNameScopeCompliance; private final boolean globalGeneratorNameScopeCompliance;
@ -24,7 +23,6 @@ public class JpaComplianceImpl implements JpaCompliance {
private final boolean cascadeCompliance; private final boolean cascadeCompliance;
public JpaComplianceImpl( public JpaComplianceImpl(
boolean listCompliance,
boolean orderByMappingCompliance, boolean orderByMappingCompliance,
boolean proxyCompliance, boolean proxyCompliance,
boolean globalGeneratorNameScopeCompliance, boolean globalGeneratorNameScopeCompliance,
@ -36,7 +34,6 @@ public class JpaComplianceImpl implements JpaCompliance {
boolean cascadeCompliance) { boolean cascadeCompliance) {
this.queryCompliance = queryCompliance; this.queryCompliance = queryCompliance;
this.transactionCompliance = transactionCompliance; this.transactionCompliance = transactionCompliance;
this.listCompliance = listCompliance;
this.closedCompliance = closedCompliance; this.closedCompliance = closedCompliance;
this.proxyCompliance = proxyCompliance; this.proxyCompliance = proxyCompliance;
this.cachingCompliance = cachingCompliance; this.cachingCompliance = cachingCompliance;
@ -61,11 +58,6 @@ public class JpaComplianceImpl implements JpaCompliance {
return cascadeCompliance; return cascadeCompliance;
} }
@Override
public boolean isJpaListComplianceEnabled() {
return listCompliance;
}
@Override @Override
public boolean isJpaClosedComplianceEnabled() { public boolean isJpaClosedComplianceEnabled() {
return closedCompliance; return closedCompliance;
@ -98,7 +90,6 @@ public class JpaComplianceImpl implements JpaCompliance {
public static class JpaComplianceBuilder { public static class JpaComplianceBuilder {
private boolean queryCompliance; private boolean queryCompliance;
private boolean listCompliance;
private boolean orderByMappingCompliance; private boolean orderByMappingCompliance;
private boolean proxyCompliance; private boolean proxyCompliance;
private boolean globalGeneratorNameScopeCompliance; private boolean globalGeneratorNameScopeCompliance;
@ -116,11 +107,6 @@ public class JpaComplianceImpl implements JpaCompliance {
return this; return this;
} }
public JpaComplianceBuilder setListCompliance(boolean listCompliance) {
this.listCompliance = listCompliance;
return this;
}
public JpaComplianceBuilder setOrderByMappingCompliance(boolean orderByMappingCompliance) { public JpaComplianceBuilder setOrderByMappingCompliance(boolean orderByMappingCompliance) {
this.orderByMappingCompliance = orderByMappingCompliance; this.orderByMappingCompliance = orderByMappingCompliance;
return this; return this;
@ -163,7 +149,6 @@ public class JpaComplianceImpl implements JpaCompliance {
JpaCompliance createJpaCompliance() { JpaCompliance createJpaCompliance() {
return new JpaComplianceImpl( return new JpaComplianceImpl(
listCompliance,
orderByMappingCompliance, orderByMappingCompliance,
proxyCompliance, proxyCompliance,
globalGeneratorNameScopeCompliance, globalGeneratorNameScopeCompliance,

View File

@ -17,7 +17,6 @@ import org.hibernate.jpa.spi.MutableJpaCompliance;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class MutableJpaComplianceImpl implements MutableJpaCompliance { public class MutableJpaComplianceImpl implements MutableJpaCompliance {
private boolean listCompliance;
private boolean orderByMappingCompliance; private boolean orderByMappingCompliance;
private boolean proxyCompliance; private boolean proxyCompliance;
private boolean generatorNameScopeCompliance; private boolean generatorNameScopeCompliance;
@ -38,12 +37,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
public MutableJpaComplianceImpl(Map<?,?> configurationSettings, boolean jpaByDefault) { public MutableJpaComplianceImpl(Map<?,?> configurationSettings, boolean jpaByDefault) {
final Object legacyQueryCompliance = configurationSettings.get( AvailableSettings.JPAQL_STRICT_COMPLIANCE ); final Object legacyQueryCompliance = configurationSettings.get( AvailableSettings.JPAQL_STRICT_COMPLIANCE );
//noinspection deprecation
listCompliance = ConfigurationHelper.getBoolean(
AvailableSettings.JPA_LIST_COMPLIANCE,
configurationSettings,
jpaByDefault
);
proxyCompliance = ConfigurationHelper.getBoolean( proxyCompliance = ConfigurationHelper.getBoolean(
AvailableSettings.JPA_PROXY_COMPLIANCE, AvailableSettings.JPA_PROXY_COMPLIANCE,
configurationSettings, configurationSettings,
@ -100,11 +93,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
return true; return true;
} }
@Override
public boolean isJpaListComplianceEnabled() {
return listCompliance;
}
@Override @Override
public boolean isJpaClosedComplianceEnabled() { public boolean isJpaClosedComplianceEnabled() {
return closedCompliance; return closedCompliance;
@ -138,11 +126,6 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Mutators // Mutators
@Override
public void setListCompliance(boolean listCompliance) {
this.listCompliance = listCompliance;
}
@Override @Override
public void setCascadeCompliance(boolean cascadeCompliance) { public void setCascadeCompliance(boolean cascadeCompliance) {
} }
@ -189,8 +172,7 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
@Override @Override
public JpaCompliance immutableCopy() { public JpaCompliance immutableCopy() {
JpaComplianceImpl.JpaComplianceBuilder builder = new JpaComplianceImpl.JpaComplianceBuilder(); JpaComplianceImpl.JpaComplianceBuilder builder = new JpaComplianceImpl.JpaComplianceBuilder();
builder = builder.setListCompliance( listCompliance ) builder = builder.setProxyCompliance( proxyCompliance )
.setProxyCompliance( proxyCompliance )
.setOrderByMappingCompliance( orderByMappingCompliance ) .setOrderByMappingCompliance( orderByMappingCompliance )
.setGlobalGeneratorNameCompliance( generatorNameScopeCompliance ) .setGlobalGeneratorNameCompliance( generatorNameScopeCompliance )
.setQueryCompliance( queryCompliance ) .setQueryCompliance( queryCompliance )

View File

@ -42,28 +42,6 @@ public interface JpaCompliance {
*/ */
boolean isJpaTransactionComplianceEnabled(); boolean isJpaTransactionComplianceEnabled();
/**
* Controls how Hibernate interprets a mapped {@link java.util.List}
* without no {@linkplain jakarta.persistence.OrderColumn order column}
* specified. Historically Hibernate treats this as a "bag", which is a
* concept JPA does not have.
* <ul>
* <li>If enabled, Hibernate will recognize this case as a
* {@linkplain org.hibernate.collection.spi.PersistentList list}.
* <li>Otherwise, if disabled, Hibernate will treat it as a
* {@linkplain org.hibernate.collection.spi.PersistentBag "bag"}.
* </ul>
*
* @return {@code true} indicates to behave in the spec-defined way,
* interpreting the mapping as a "list", rather than a "bag"
*
* @see org.hibernate.cfg.AvailableSettings#JPA_LIST_COMPLIANCE
*
* @deprecated Use {@link org.hibernate.cfg.AvailableSettings#DEFAULT_LIST_SEMANTICS} instead
*/
@Deprecated( since = "6.0" )
boolean isJpaListComplianceEnabled();
/** /**
* JPA defines specific exceptions on specific methods when called on * JPA defines specific exceptions on specific methods when called on
* {@link jakarta.persistence.EntityManager} and * {@link jakarta.persistence.EntityManager} and

View File

@ -16,8 +16,6 @@ public interface MutableJpaCompliance extends JpaCompliance {
@Deprecated @Deprecated
void setCascadeCompliance(boolean cascadeCompliance); void setCascadeCompliance(boolean cascadeCompliance);
void setListCompliance(boolean listCompliance);
void setOrderByMappingCompliance(boolean orderByCompliance); void setOrderByMappingCompliance(boolean orderByCompliance);
void setProxyCompliance(boolean proxyCompliance); void setProxyCompliance(boolean proxyCompliance);

View File

@ -29,11 +29,6 @@ public class JpaComplianceStub implements JpaCompliance {
return false; return false;
} }
@Override
public boolean isJpaListComplianceEnabled() {
return false;
}
@Override @Override
public boolean isJpaClosedComplianceEnabled() { public boolean isJpaClosedComplianceEnabled() {
return false; return false;

View File

@ -48,7 +48,6 @@ public class JpaComplianceTests {
assertThat( compliance.isJpaQueryComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaQueryComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaTransactionComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaTransactionComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaClosedComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaClosedComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaListComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaOrderByMappingComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaOrderByMappingComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaProxyComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaProxyComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaCacheComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaCacheComplianceEnabled() ).isEqualTo( expected );
@ -78,7 +77,6 @@ public class JpaComplianceTests {
assertThat( compliance.isJpaQueryComplianceEnabled() ).isEqualTo( !expected ); assertThat( compliance.isJpaQueryComplianceEnabled() ).isEqualTo( !expected );
assertThat( compliance.isJpaTransactionComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaTransactionComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaClosedComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaClosedComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaListComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaOrderByMappingComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaOrderByMappingComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaProxyComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaProxyComplianceEnabled() ).isEqualTo( expected );
assertThat( compliance.isJpaCacheComplianceEnabled() ).isEqualTo( expected ); assertThat( compliance.isJpaCacheComplianceEnabled() ).isEqualTo( expected );

View File

@ -99,7 +99,6 @@ public class EntityManagerFactoryExtension
pui.getProperties().put( AvailableSettings.JPA_COMPLIANCE, emfAnn.jpaComplianceEnabled() ); pui.getProperties().put( AvailableSettings.JPA_COMPLIANCE, emfAnn.jpaComplianceEnabled() );
pui.getProperties().put( AvailableSettings.JPA_QUERY_COMPLIANCE, emfAnn.queryComplianceEnabled() ); pui.getProperties().put( AvailableSettings.JPA_QUERY_COMPLIANCE, emfAnn.queryComplianceEnabled() );
pui.getProperties().put( AvailableSettings.JPA_TRANSACTION_COMPLIANCE, emfAnn.transactionComplianceEnabled() ); pui.getProperties().put( AvailableSettings.JPA_TRANSACTION_COMPLIANCE, emfAnn.transactionComplianceEnabled() );
pui.getProperties().put( AvailableSettings.JPA_LIST_COMPLIANCE, emfAnn.listMappingComplianceEnabled() );
pui.getProperties().put( AvailableSettings.JPA_CLOSED_COMPLIANCE, emfAnn.closedComplianceEnabled() ); pui.getProperties().put( AvailableSettings.JPA_CLOSED_COMPLIANCE, emfAnn.closedComplianceEnabled() );
pui.getProperties().put( AvailableSettings.JPA_PROXY_COMPLIANCE, emfAnn.proxyComplianceEnabled() ); pui.getProperties().put( AvailableSettings.JPA_PROXY_COMPLIANCE, emfAnn.proxyComplianceEnabled() );
pui.getProperties().put( AvailableSettings.JPA_CACHING_COMPLIANCE, emfAnn.cacheComplianceEnabled() ); pui.getProperties().put( AvailableSettings.JPA_CACHING_COMPLIANCE, emfAnn.cacheComplianceEnabled() );

View File

@ -83,12 +83,6 @@ public @interface Jpa {
*/ */
boolean closedComplianceEnabled() default false; boolean closedComplianceEnabled() default false;
/**
* @see JpaCompliance#isJpaListComplianceEnabled()
* @see org.hibernate.cfg.AvailableSettings#DEFAULT_LIST_SEMANTICS
*/
boolean listMappingComplianceEnabled() default false;
/** /**
* @see JpaCompliance#isJpaOrderByMappingComplianceEnabled() * @see JpaCompliance#isJpaOrderByMappingComplianceEnabled()
*/ */