Skip to content

Commit

Permalink
Remove deprecated JPA_METAMODEL_GENERATION and JPA_METAMODEL_POPULATI…
Browse files Browse the repository at this point in the history
…ON from AvailableSettings

Signed-off-by: Jan Schatteman <[email protected]>
  • Loading branch information
jrenaat committed Nov 12, 2021
1 parent 60a3c08 commit db12d5a
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1152,15 +1152,6 @@ XML configuration file to use to configure Hibernate.
If true, the persistence context will be discarded (think `clear()` when the method is called).
Otherwise, the persistence context will stay alive till the transaction completion: all objects will remain managed, and any change will be synchronized with the database (default to false, ie wait for transaction completion).

`*hibernate.ejb.metamodel.population*` (e.g. `enabled` or `disabled`, or `ignoreUnsupported` (default value))::
Setting that indicates whether to build the Jakarta Persistence types.
+
Accepts three values:
+
enabled::: Do the build.
disabled::: Do not do the build.
ignoreUnsupported::: Do the build, but ignore any non-Jakarta Persistence features that would otherwise result in a failure (e.g. `@Any` annotation).

`*hibernate.jpa.static_metamodel.population*` (e.g. `enabled` or `disabled`, or `skipUnsupported` (default value))::
Setting that controls whether we seek out Jakarta Persistence _static metamodel_ classes and populate them.
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,32 +269,6 @@ public interface AvailableSettings {
@Deprecated
String ENVIRONMENT_CLASSLOADER = "hibernate.classLoader.environment";

/**
* @deprecated use {@link #JPA_METAMODEL_POPULATION} instead.
*/
@Deprecated
String JPA_METAMODEL_GENERATION = "hibernate.ejb.metamodel.generation";

/**
* Setting that indicates whether to build the JPA types. Accepts
* 3 values:<ul>
* <li>
* <b>enabled</b> - Do the build
* </li>
* <li>
* <b>disabled</b> - Do not do the build
* </li>
* <li>
* <b>ignoreUnsupported</b> - Do the build, but ignore any non-JPA features that would otherwise
* result in a failure.
* </li>
* </ul>
*
*
*/
@Deprecated
String JPA_METAMODEL_POPULATION = "hibernate.ejb.metamodel.population";

/**
* Setting that controls whether we seek out JPA "static metamodel" classes and populate them. Accepts
* 3 values:<ul>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Map;

import org.hibernate.cfg.AvailableSettings;
import org.hibernate.internal.log.DeprecationLogger;
import org.hibernate.internal.util.config.ConfigurationHelper;

/**
Expand Down Expand Up @@ -61,32 +60,6 @@ private static String determineSetting(Map configurationValues) {
return setting;
}

final String legacySetting1 = ConfigurationHelper.getString(
AvailableSettings.JPA_METAMODEL_POPULATION,
configurationValues,
null
);
if ( legacySetting1 != null ) {
DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting(
AvailableSettings.JPA_METAMODEL_POPULATION,
AvailableSettings.STATIC_METAMODEL_POPULATION
);
return legacySetting1;
}

final String legacySetting2 = ConfigurationHelper.getString(
AvailableSettings.JPA_METAMODEL_GENERATION,
configurationValues,
null
);
if ( legacySetting2 != null ) {
DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting(
AvailableSettings.JPA_METAMODEL_GENERATION,
AvailableSettings.STATIC_METAMODEL_POPULATION
);
return legacySetting1;
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected Class<?>[] getAnnotatedClasses() {
@Override
protected void addConfigOptions(Map options) {
super.addConfigOptions( options );
options.put( AvailableSettings.JPA_METAMODEL_POPULATION, getJpaMetamodelPopulationValue() );
options.put( AvailableSettings.STATIC_METAMODEL_POPULATION, getJpaMetamodelPopulationValue() );
}

@Test
Expand Down Expand Up @@ -120,7 +120,7 @@ private void assertManagedTypes(Metamodel metamodel) {
assertEquals( 8, metamodel.getManagedTypes().size() );
}
else {
// When ignoreUnsupported is used, any managed-type that refers to a dynamic-map entity type
// When skipUnsupported is used, any managed-type that refers to a dynamic-map entity type
// or a managed type that is owned by said dynamic-map entity type should be excluded.
// Therefore this collection should only include 3 elements
// EntityType(SimpleAnnotated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* @author Chris Cranford
*/
@TestForIssue(jiraKey = "HHH-12871")
public class JpaMetamodelIgnoreUnsupportedPopulationTest extends AbstractJpaMetamodelPopulationTest {
public class JpaMetamodelskipUnsupportedPopulationTest extends AbstractJpaMetamodelPopulationTest {
@Override
protected String getJpaMetamodelPopulationValue() {
return "ignoreUnsupported";
return "skipUnsupported";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author Brad Koehn
*/
@Jpa(
integrationSettings = { @Setting(name = AvailableSettings.JPA_METAMODEL_POPULATION, value = "enabled") },
integrationSettings = { @Setting(name = AvailableSettings.STATIC_METAMODEL_POPULATION, value = "enabled") },
xmlMappings = { "org/hibernate/orm/test/jpa/criteria/paths/PolicyAndDistribution.hbm.xml" }
)
public class SingularAttributeJoinTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
)
@ServiceRegistry(
settings = @Setting(
name = AvailableSettings.JPA_METAMODEL_POPULATION,
value = "ignoreUnsupported"
name = AvailableSettings.STATIC_METAMODEL_POPULATION,
value = "skipUnsupported"
)
)
@DomainModel( annotatedClasses = BasicContributorTests.MainEntity.class )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public String[] getMappings() {
@Override
protected void configure(Configuration configuration) {
// the Customer entity has a composite id that is not embeddable ( not supported by JPA ).
configuration.setProperty( AvailableSettings.JPA_METAMODEL_POPULATION, "disabled" );
configuration.setProperty( AvailableSettings.STATIC_METAMODEL_POPULATION, "disabled" );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,29 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.envers.Audited;
import org.hibernate.envers.DefaultRevisionEntity;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.persister.entity.EntityPersister;

import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.Setting;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

/**
* @author Steve Ebersole
*/
@ServiceRegistry(
settings = @Setting(
name = AvailableSettings.JPA_METAMODEL_POPULATION,
value = "ignoreUnsupported"
name = AvailableSettings.STATIC_METAMODEL_POPULATION,
value = "skipUnsupported"
)
)
@DomainModel(
Expand Down

0 comments on commit db12d5a

Please sign in to comment.