Search in sources :

Example 1 with ProgrammaticMappingConfigurationContext

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext in project hibernate-search by hibernate.

the class ProgrammaticMappingSmokeIT method setup.

@Before
public void setup() {
    backendMock.expectSchema(OtherIndexedEntity.INDEX, b -> b.field("numeric", Integer.class).field("numericAsString", String.class));
    backendMock.expectSchema(YetAnotherIndexedEntity.INDEX, b -> b.objectField("customBridgeOnProperty", b2 -> b2.field("date", LocalDate.class).field("text", String.class)).field("myLocalDateField", LocalDate.class).field("numeric", Integer.class).objectField("embeddedIterable", b2 -> b2.multiValued(true).objectField("myEmbedded", b3 -> b3.field("myTextField", String.class))).objectField("myEmbeddedList", b2 -> b2.multiValued(true).objectField("myEmbedded", b3 -> b3.objectField("customBridgeOnClass", b4 -> b4.field("text", String.class)))).objectField("embeddedArrayList", b2 -> b2.multiValued(true).objectField("myEmbedded", b3 -> b3.objectField("customBridgeOnProperty", b4 -> b4.field("text", String.class)))).field("embeddedMapKeys", String.class, b2 -> b2.multiValued(true)).objectField("embeddedMap", b2 -> b2.multiValued(true).objectField("myEmbedded", b3 -> b3.field("myLocalDateField", LocalDate.class))));
    backendMock.expectSchema(IndexedEntity.INDEX, b -> b.objectField("customBridgeOnClass", b2 -> b2.field("date", LocalDate.class).field("text", String.class)).objectField("customBridgeOnProperty", b2 -> b2.field("date", LocalDate.class).field("text", String.class)).objectField("myEmbedded", b2 -> b2.objectField("customBridgeOnClass", b3 -> b3.field("date", LocalDate.class).field("text", String.class)).objectField("customBridgeOnProperty", b3 -> b3.field("date", LocalDate.class).field("text", String.class)).objectField("myEmbedded", b3 -> b3.objectField("customBridgeOnClass", b4 -> b4.field("text", String.class))).field("myLocalDateField", LocalDate.class).field("myTextField", String.class)).field("myTextField", String.class).field("myLocalDateField", LocalDate.class));
    mapping = setupHelper.start().expectCustomBeans().withConfiguration(builder -> {
        builder.addEntityTypes(CollectionHelper.asSet(IndexedEntity.class, OtherIndexedEntity.class, YetAnotherIndexedEntity.class));
        ProgrammaticMappingConfigurationContext mappingDefinition = builder.programmaticMapping();
        TypeMappingStep indexedEntityMapping = mappingDefinition.type(IndexedEntity.class);
        indexedEntityMapping.indexed().index(IndexedEntity.INDEX);
        indexedEntityMapping.binder(new CustomTypeBridge.Binder().objectName("customBridgeOnClass"));
        indexedEntityMapping.property("id").documentId();
        indexedEntityMapping.property("text").genericField("myTextField");
        indexedEntityMapping.property("embedded").indexedEmbedded("myEmbedded").includeDepth(1).includePaths("customBridgeOnClass.text", "myEmbedded.customBridgeOnClass.text");
        ProgrammaticMappingConfigurationContext secondMappingDefinition = builder.programmaticMapping();
        TypeMappingStep parentIndexedEntityMapping = secondMappingDefinition.type(ParentIndexedEntity.class);
        parentIndexedEntityMapping.property("localDate").genericField("myLocalDateField");
        parentIndexedEntityMapping.property("embedded").associationInverseSide(PojoModelPath.ofValue("embeddingAsSingle")).binder(new CustomPropertyBridge.Binder().objectName("customBridgeOnProperty"));
        TypeMappingStep otherIndexedEntityMapping = secondMappingDefinition.type(OtherIndexedEntity.class);
        otherIndexedEntityMapping.indexed().index(OtherIndexedEntity.INDEX);
        otherIndexedEntityMapping.property("id").documentId();
        otherIndexedEntityMapping.property("numeric").genericField().genericField("numericAsString").valueBridge(IntegerAsStringValueBridge.class);
        TypeMappingStep yetAnotherIndexedEntityMapping = secondMappingDefinition.type(YetAnotherIndexedEntity.class);
        yetAnotherIndexedEntityMapping.indexed().index(YetAnotherIndexedEntity.INDEX);
        yetAnotherIndexedEntityMapping.property("id").documentId();
        yetAnotherIndexedEntityMapping.property("numeric").genericField();
        yetAnotherIndexedEntityMapping.property("embeddedIterable").associationInverseSide(PojoModelPath.ofValue("embeddingAsIterable")).indexedEmbedded().includePaths("myEmbedded.myTextField");
        yetAnotherIndexedEntityMapping.property("embeddedList").associationInverseSide(PojoModelPath.ofValue("embeddingAsList")).indexedEmbedded("myEmbeddedList").includePaths("myEmbedded.customBridgeOnClass.text");
        yetAnotherIndexedEntityMapping.property("embeddedArrayList").associationInverseSide(PojoModelPath.ofValue("embeddingAsArrayList")).indexedEmbedded().includePaths("myEmbedded.customBridgeOnProperty.text");
        yetAnotherIndexedEntityMapping.property("embeddedMap").associationInverseSide(PojoModelPath.ofValue("embeddingAsMap")).genericField("embeddedMapKeys").extractor(BuiltinContainerExtractors.MAP_KEY).indexedEmbedded().includePaths("myEmbedded.myLocalDateField");
    }).setup();
    backendMock.verifyExpectationsMet();
}
Also used : EntityReferenceImpl(org.hibernate.search.mapper.javabean.common.impl.EntityReferenceImpl) IntegerAsStringValueBridge(org.hibernate.search.integrationtest.mapper.pojo.smoke.bridge.IntegerAsStringValueBridge) Arrays(java.util.Arrays) PojoModelPath(org.hibernate.search.mapper.pojo.model.path.PojoModelPath) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) StubBackendUtils.reference(org.hibernate.search.util.impl.integrationtest.common.stub.backend.StubBackendUtils.reference) JavaBeanMappingSetupHelper(org.hibernate.search.integrationtest.mapper.pojo.testsupport.util.rule.JavaBeanMappingSetupHelper) EntityReference(org.hibernate.search.mapper.javabean.common.EntityReference) BuiltinContainerExtractors(org.hibernate.search.mapper.pojo.extractor.builtin.BuiltinContainerExtractors) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SearchMapping(org.hibernate.search.mapper.javabean.mapping.SearchMapping) Map(java.util.Map) TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep) StubSearchWorkBehavior(org.hibernate.search.util.impl.integrationtest.common.rule.StubSearchWorkBehavior) LinkedHashSet(java.util.LinkedHashSet) Before(org.junit.Before) SearchScope(org.hibernate.search.mapper.javabean.scope.SearchScope) CustomPropertyBridge(org.hibernate.search.integrationtest.mapper.pojo.smoke.bridge.CustomPropertyBridge) CustomTypeBridge(org.hibernate.search.integrationtest.mapper.pojo.smoke.bridge.CustomTypeBridge) MethodHandles(java.lang.invoke.MethodHandles) SearchSession(org.hibernate.search.mapper.javabean.session.SearchSession) Test(org.junit.Test) List(java.util.List) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) Rule(org.junit.Rule) LocalDate(java.time.LocalDate) SearchQuery(org.hibernate.search.engine.search.query.SearchQuery) SearchResult(org.hibernate.search.engine.search.query.SearchResult) BackendMock(org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock) CollectionHelper(org.hibernate.search.util.common.impl.CollectionHelper) TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) LocalDate(java.time.LocalDate) Before(org.junit.Before)

Example 2 with ProgrammaticMappingConfigurationContext

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext in project hibernate-search by hibernate.

the class ProgrammaticMappingGeoPointBindingIT method setup.

@Before
public void setup() {
    backendMock.expectSchema(GeoPointOnTypeEntity.INDEX, b -> b.field("homeLocation", GeoPoint.class, b2 -> b2.projectable(Projectable.YES).sortable(Sortable.YES)).field("workLocation", GeoPoint.class, b2 -> b2.projectable(Projectable.DEFAULT).sortable(Sortable.DEFAULT)));
    backendMock.expectSchema(GeoPointOnCoordinatesPropertyEntity.INDEX, b -> b.field("coord", GeoPoint.class).field("location", GeoPoint.class, b2 -> b2.projectable(Projectable.NO)));
    backendMock.expectSchema(GeoPointOnCustomCoordinatesPropertyEntity.INDEX, b -> b.field("coord", GeoPoint.class, b2 -> b2.projectable(Projectable.DEFAULT).sortable(Sortable.DEFAULT)).field("location", GeoPoint.class, b2 -> b2.projectable(Projectable.DEFAULT).sortable(Sortable.DEFAULT)));
    mapping = setupHelper.start().withConfiguration(builder -> {
        builder.addEntityTypes(CollectionHelper.asSet(GeoPointOnTypeEntity.class, GeoPointOnCoordinatesPropertyEntity.class, GeoPointOnCustomCoordinatesPropertyEntity.class));
        ProgrammaticMappingConfigurationContext mappingDefinition = builder.programmaticMapping();
        TypeMappingStep geoPointOntTypeEntityMapping = mappingDefinition.type(GeoPointOnTypeEntity.class);
        geoPointOntTypeEntityMapping.indexed().index(GeoPointOnTypeEntity.INDEX);
        geoPointOntTypeEntityMapping.binder(GeoPointBinder.create().fieldName("homeLocation").markerSet("home").projectable(Projectable.YES).sortable(Sortable.YES));
        geoPointOntTypeEntityMapping.binder(GeoPointBinder.create().fieldName("workLocation").markerSet("work"));
        geoPointOntTypeEntityMapping.property("id").documentId();
        geoPointOntTypeEntityMapping.property("homeLatitude").marker(GeoPointBinder.latitude().markerSet("home"));
        geoPointOntTypeEntityMapping.property("homeLongitude").marker(GeoPointBinder.longitude().markerSet("home"));
        geoPointOntTypeEntityMapping.property("workLatitude").marker(GeoPointBinder.latitude().markerSet("work"));
        geoPointOntTypeEntityMapping.property("workLongitude").marker(GeoPointBinder.longitude().markerSet("work"));
        TypeMappingStep geoPointOnCoordinatesPropertyEntityMapping = mappingDefinition.type(GeoPointOnCoordinatesPropertyEntity.class);
        geoPointOnCoordinatesPropertyEntityMapping.indexed().index(GeoPointOnCoordinatesPropertyEntity.INDEX);
        geoPointOnCoordinatesPropertyEntityMapping.property("id").documentId();
        geoPointOnCoordinatesPropertyEntityMapping.property("coord").genericField().genericField("location").projectable(Projectable.NO);
        TypeMappingStep geoPointOnCustomCoordinatesPropertyEntityMapping = mappingDefinition.type(GeoPointOnCustomCoordinatesPropertyEntity.class);
        geoPointOnCustomCoordinatesPropertyEntityMapping.indexed().index(GeoPointOnCustomCoordinatesPropertyEntity.INDEX);
        geoPointOnCustomCoordinatesPropertyEntityMapping.property("id").documentId();
        geoPointOnCustomCoordinatesPropertyEntityMapping.property("coord").binder(GeoPointBinder.create()).binder(GeoPointBinder.create().fieldName("location"));
        TypeMappingStep customCoordinatesMapping = mappingDefinition.type(CustomCoordinates.class);
        customCoordinatesMapping.property("lat").marker(GeoPointBinder.latitude());
        customCoordinatesMapping.property("lon").marker(GeoPointBinder.longitude());
    }).setup();
    backendMock.verifyExpectationsMet();
}
Also used : Sortable(org.hibernate.search.engine.backend.types.Sortable) GeoPoint(org.hibernate.search.engine.spatial.GeoPoint) MethodHandles(java.lang.invoke.MethodHandles) JavaBeanMappingSetupHelper(org.hibernate.search.integrationtest.mapper.pojo.testsupport.util.rule.JavaBeanMappingSetupHelper) SearchSession(org.hibernate.search.mapper.javabean.session.SearchSession) Test(org.junit.Test) SearchMapping(org.hibernate.search.mapper.javabean.mapping.SearchMapping) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) Rule(org.junit.Rule) TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep) GeoPointBinder(org.hibernate.search.mapper.pojo.bridge.builtin.programmatic.GeoPointBinder) BackendMock(org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock) Projectable(org.hibernate.search.engine.backend.types.Projectable) CollectionHelper(org.hibernate.search.util.common.impl.CollectionHelper) Before(org.junit.Before) GeoPoint(org.hibernate.search.engine.spatial.GeoPoint) TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) Before(org.junit.Before)

Example 3 with ProgrammaticMappingConfigurationContext

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext in project hibernate-search by hibernate.

the class DefaultReindexOnUpdateIT method default_associationInverseSideKnown.

/**
 * If ReindexOnUpdate.DEFAULT is the default,
 * and the inverse side of associations is correctly set up,
 * then Hibernate Search will handle embedding *and* automatic reindexing.
 */
@Test
public void default_associationInverseSideKnown() {
    backendMock.expectSchema("ParentEntity", b -> b.field("value", String.class).objectField("child", b2 -> b2.field("value", String.class)));
    backendMock.expectSchema("ChildEntity", b -> b.field("value", String.class));
    mapping = setupHelper.start().withConfiguration(builder -> {
        builder.defaultReindexOnUpdate(ReindexOnUpdate.DEFAULT);
        builder.addEntityType(ParentEntity.class);
        builder.addEntityType(ChildEntity.class);
        ProgrammaticMappingConfigurationContext mappingDefinition = builder.programmaticMapping();
        TypeMappingStep parentMapping = mappingDefinition.type(ParentEntity.class);
        parentMapping.indexed();
        parentMapping.property("id").documentId();
        parentMapping.property("value").genericField();
        parentMapping.property("child").associationInverseSide(PojoModelPath.ofValue("parent")).indexedEmbedded();
        TypeMappingStep childMapping = mappingDefinition.type(ChildEntity.class);
        childMapping.indexed();
        childMapping.property("id").documentId();
        childMapping.property("value").genericField();
    }).setup();
    backendMock.verifyExpectationsMet();
    ParentEntity parent = new ParentEntity();
    parent.id = 1;
    parent.value = "val1";
    ChildEntity child = new ChildEntity();
    child.id = 2;
    child.value = "val2";
    parent.child = child;
    child.parent = parent;
    // Test indexed-embedding
    try (SearchSession session = mapping.createSession()) {
        session.indexingPlan().add(parent);
        backendMock.expectWorks("ParentEntity").add("1", b -> b.field("value", "val1").objectField("child", b2 -> b2.field("value", "val2")));
    }
    // Test automatic reindexing
    try (SearchSession session = mapping.createSession()) {
        session.indexingPlan().addOrUpdate(child);
        backendMock.expectWorks("ChildEntity").addOrUpdate("2", b -> b.field("value", "val2"));
        // The child was updated, thus the parent (which index-embeds the childs) is reindexed.
        backendMock.expectWorks("ParentEntity").addOrUpdate("1", b -> b.field("value", "val1").objectField("child", b2 -> b2.field("value", "val2")));
    }
}
Also used : ReindexOnUpdate(org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate) SearchException(org.hibernate.search.util.common.SearchException) PojoModelPath(org.hibernate.search.mapper.pojo.model.path.PojoModelPath) MethodHandles(java.lang.invoke.MethodHandles) JavaBeanMappingSetupHelper(org.hibernate.search.integrationtest.mapper.pojo.testsupport.util.rule.JavaBeanMappingSetupHelper) SearchSession(org.hibernate.search.mapper.javabean.session.SearchSession) Test(org.junit.Test) SearchMapping(org.hibernate.search.mapper.javabean.mapping.SearchMapping) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) Rule(org.junit.Rule) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep) FailureReportUtils(org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils) BackendMock(org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock) Before(org.junit.Before) TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) SearchSession(org.hibernate.search.mapper.javabean.session.SearchSession) Test(org.junit.Test)

Example 4 with ProgrammaticMappingConfigurationContext

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext in project infinispan by infinispan.

the class SerializationContextSearchMapping method createBuilder.

public static SearchMappingBuilder createBuilder(SearchMappingCommonBuilding commonBuilding, EntityLoader<EntityReference, ?> entityLoader, Set<String> indexedEntityTypes, SerializationContext serializationContext) {
    GlobalReferenceHolder globalReferenceHolder = new GlobalReferenceHolder(serializationContext.getGenericDescriptors());
    ProtobufBootstrapIntrospector introspector = new ProtobufBootstrapIntrospector();
    SearchMappingBuilder builder = commonBuilding.builder(introspector);
    builder.setEntityLoader(entityLoader);
    builder.setEntityConverter(new ProtobufEntityConverter(serializationContext, globalReferenceHolder.getRootMessages()));
    ProgrammaticMappingConfigurationContext programmaticMapping = builder.programmaticMapping();
    boolean existIndexedEntities = false;
    for (GlobalReferenceHolder.RootMessageInfo rootMessage : globalReferenceHolder.getRootMessages()) {
        String fullName = rootMessage.getFullName();
        if (!indexedEntityTypes.contains(fullName)) {
            continue;
        }
        existIndexedEntities = true;
        programmaticMapping.type(fullName).binder(new ProtobufMessageBinder(globalReferenceHolder, fullName)).indexed().index(rootMessage.getIndexName());
        builder.addEntityType(byte[].class, fullName);
    }
    return existIndexedEntities ? builder : null;
}
Also used : ProtobufBootstrapIntrospector(org.infinispan.query.remote.impl.mapping.model.ProtobufBootstrapIntrospector) SearchMappingBuilder(org.infinispan.search.mapper.mapping.SearchMappingBuilder) GlobalReferenceHolder(org.infinispan.query.remote.impl.mapping.reference.GlobalReferenceHolder) ProtobufEntityConverter(org.infinispan.query.remote.impl.indexing.ProtobufEntityConverter) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) ProtobufMessageBinder(org.infinispan.query.remote.impl.mapping.typebridge.ProtobufMessageBinder)

Example 5 with ProgrammaticMappingConfigurationContext

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext in project hibernate-search by hibernate.

the class DocumentationSetupHelper method testParamsForBothAnnotationsAndProgrammatic.

public static List<DocumentationSetupHelper> testParamsForBothAnnotationsAndProgrammatic(BackendConfiguration backendConfiguration, Consumer<ProgrammaticMappingConfigurationContext> programmaticMappingContributor) {
    HibernateOrmSearchMappingConfigurer mappingConfigurer = context -> programmaticMappingContributor.accept(context.programmaticMapping());
    List<DocumentationSetupHelper> result = new ArrayList<>();
    // Annotation-based mapping
    result.add(withSingleBackend(backendConfiguration, null));
    // Programmatic mapping
    result.add(withSingleBackend(backendConfiguration, mappingConfigurer));
    return result;
}
Also used : Arrays(java.util.Arrays) SchemaManagementStrategyName(org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName) SimpleSessionFactoryBuilder(org.hibernate.search.util.impl.integrationtest.mapper.orm.SimpleSessionFactoryBuilder) SessionFactory(org.hibernate.SessionFactory) HibernateOrmMappingHandle(org.hibernate.search.util.impl.integrationtest.mapper.orm.HibernateOrmMappingHandle) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Consumer(java.util.function.Consumer) AutomaticIndexingSynchronizationStrategyNames(org.hibernate.search.mapper.orm.automaticindexing.session.AutomaticIndexingSynchronizationStrategyNames) List(java.util.List) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) HibernateOrmMapperSettings(org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings) HibernateOrmSearchMappingConfigurer(org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer) Map(java.util.Map) BackendMappingHandle(org.hibernate.search.util.impl.integrationtest.common.stub.backend.BackendMappingHandle) MappingSetupHelper(org.hibernate.search.util.impl.integrationtest.common.rule.MappingSetupHelper) BackendSetupStrategy(org.hibernate.search.util.impl.integrationtest.common.rule.BackendSetupStrategy) BackendConfiguration(org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration) HibernateOrmSearchMappingConfigurer(org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer) ArrayList(java.util.ArrayList)

Aggregations

ProgrammaticMappingConfigurationContext (org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext)11 TypeMappingStep (org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)8 Before (org.junit.Before)5 Test (org.junit.Test)5 MethodHandles (java.lang.invoke.MethodHandles)4 JavaBeanMappingSetupHelper (org.hibernate.search.integrationtest.mapper.pojo.testsupport.util.rule.JavaBeanMappingSetupHelper)4 SearchMapping (org.hibernate.search.mapper.javabean.mapping.SearchMapping)4 SearchSession (org.hibernate.search.mapper.javabean.session.SearchSession)4 BackendMock (org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock)4 Rule (org.junit.Rule)4 ArrayList (java.util.ArrayList)3 Arrays (java.util.Arrays)3 LinkedHashMap (java.util.LinkedHashMap)3 List (java.util.List)3 Map (java.util.Map)3 PojoModelPath (org.hibernate.search.mapper.pojo.model.path.PojoModelPath)3 SearchException (org.hibernate.search.util.common.SearchException)3 Consumer (java.util.function.Consumer)2 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)2 SessionFactory (org.hibernate.SessionFactory)2