Search in sources :

Example 1 with MutableJpaComplianceImpl

use of org.hibernate.jpa.internal.MutableJpaComplianceImpl in project hibernate-orm by hibernate.

the class JpaComplianceTests method testSettingTrue.

@Test
public void testSettingTrue() {
    ServiceRegistryScope.using(() -> new StandardServiceRegistryBuilder().applySetting(AvailableSettings.JPA_COMPLIANCE, true).build(), (serviceRegistryScope) -> {
        final SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) new MetadataSources(serviceRegistryScope.getRegistry()).buildMetadata().buildSessionFactory();
        final JpaCompliance jpaCompliance = sessionFactory.getSessionFactoryOptions().getJpaCompliance();
        assertAll(jpaCompliance, true);
    });
    // MutableJpaComplianceImpl defaults its values based on the passed
    // `jpaByDefault` (`true` here).  ultimately we want to source this
    // from `AvailableSettings#JPA_COMPLIANCE`
    final MutableJpaComplianceImpl compliance = new MutableJpaComplianceImpl(Collections.emptyMap(), true);
    assertAll(compliance, true);
}
Also used : StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) MetadataSources(org.hibernate.boot.MetadataSources) JpaCompliance(org.hibernate.jpa.spi.JpaCompliance) MutableJpaComplianceImpl(org.hibernate.jpa.internal.MutableJpaComplianceImpl) Test(org.junit.jupiter.api.Test)

Example 2 with MutableJpaComplianceImpl

use of org.hibernate.jpa.internal.MutableJpaComplianceImpl in project hibernate-orm by hibernate.

the class JpaComplianceTests method testDefaultTrue.

@Test
public void testDefaultTrue() {
    // MutableJpaComplianceImpl defaults its values based on the passed
    // `jpaByDefault` (`true` here).  ultimately we want to source this
    // from `AvailableSettings#JPA_COMPLIANCE`
    final MutableJpaComplianceImpl compliance = new MutableJpaComplianceImpl(Collections.emptyMap(), true);
    assertAll(compliance, true);
}
Also used : MutableJpaComplianceImpl(org.hibernate.jpa.internal.MutableJpaComplianceImpl) Test(org.junit.jupiter.api.Test)

Example 3 with MutableJpaComplianceImpl

use of org.hibernate.jpa.internal.MutableJpaComplianceImpl in project hibernate-orm by hibernate.

the class JpaComplianceTests method testDefaultFalseWithOverride.

@Test
public void testDefaultFalseWithOverride() {
    // MutableJpaComplianceImpl defaults its values based on the passed
    // `jpaByDefault` (`true` here).  ultimately we want to source this
    // from `AvailableSettings#JPA_COMPLIANCE`
    final MutableJpaComplianceImpl compliance = new MutableJpaComplianceImpl(Collections.emptyMap(), false);
    compliance.setQueryCompliance(true);
    assertOverridden(compliance, false);
}
Also used : MutableJpaComplianceImpl(org.hibernate.jpa.internal.MutableJpaComplianceImpl) Test(org.junit.jupiter.api.Test)

Example 4 with MutableJpaComplianceImpl

use of org.hibernate.jpa.internal.MutableJpaComplianceImpl in project hibernate-orm by hibernate.

the class JpaComplianceTests method testDefaultTrueWithOverride.

@Test
public void testDefaultTrueWithOverride() {
    // MutableJpaComplianceImpl defaults its values based on the passed
    // `jpaByDefault` (`true` here).  ultimately we want to source this
    // from `AvailableSettings#JPA_COMPLIANCE`
    final MutableJpaComplianceImpl compliance = new MutableJpaComplianceImpl(Collections.emptyMap(), true);
    compliance.setQueryCompliance(false);
    assertOverridden(compliance, true);
}
Also used : MutableJpaComplianceImpl(org.hibernate.jpa.internal.MutableJpaComplianceImpl) Test(org.junit.jupiter.api.Test)

Example 5 with MutableJpaComplianceImpl

use of org.hibernate.jpa.internal.MutableJpaComplianceImpl in project hibernate-orm by hibernate.

the class JpaComplianceTests method testSettingFalse.

@Test
public void testSettingFalse() {
    ServiceRegistryScope.using(() -> new StandardServiceRegistryBuilder().applySetting(AvailableSettings.JPA_COMPLIANCE, false).build(), (serviceRegistryScope) -> {
        final SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) new MetadataSources(serviceRegistryScope.getRegistry()).buildMetadata().buildSessionFactory();
        final JpaCompliance jpaCompliance = sessionFactory.getSessionFactoryOptions().getJpaCompliance();
        assertAll(jpaCompliance, false);
    });
    // MutableJpaComplianceImpl defaults its values based on the passed
    // `jpaByDefault` (`true` here).  ultimately we want to source this
    // from `AvailableSettings#JPA_COMPLIANCE`
    final MutableJpaComplianceImpl compliance = new MutableJpaComplianceImpl(Collections.emptyMap(), true);
    assertAll(compliance, true);
}
Also used : StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) MetadataSources(org.hibernate.boot.MetadataSources) JpaCompliance(org.hibernate.jpa.spi.JpaCompliance) MutableJpaComplianceImpl(org.hibernate.jpa.internal.MutableJpaComplianceImpl) Test(org.junit.jupiter.api.Test)

Aggregations

MutableJpaComplianceImpl (org.hibernate.jpa.internal.MutableJpaComplianceImpl)6 Test (org.junit.jupiter.api.Test)6 MetadataSources (org.hibernate.boot.MetadataSources)2 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)2 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)2 JpaCompliance (org.hibernate.jpa.spi.JpaCompliance)2